Announcement

Collapse
No announcement yet.

HS3 - Real Time Device Monitoring from node.js - HomeKit Plugin Mod.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HS3 - Real Time Device Monitoring from node.js - HomeKit Plugin Mod.

    Does anybody know if it is possible for an external program to open a connection to HomeSeer and get an instant report each time a device's value changes?
    If so, and you can point to code samples, that would be appreciated (particularly, code samples in nodejs / Javscript).

    Some more details ...
    I'm using Homebridge with the Homeseer plugin. Homebridge's HomeSeer plugin currently gets status updates by polling HomeSeer (by default, every 60 seconds). While polling works O.K. for devices where you don't need instant updates, its ineffective for things like a door contact sensor when you want to trigger events that occur instantly upon, e.g., opening the door. Of course, you could just poll rapidly, but then HomeSeer seems to become unresponsive. I'd like to modify the Homebridge Homeseer plugin so that it opens a channel to HomeSeer and then gets status updates over that channel whenever device values change.

    Is this possible?

    #2
    Originally posted by jvm View Post
    Does anybody know if it is possible for an external program to open a connection to HomeSeer and get an instant report each time a device's value changes?
    If so, and you can point to code samples, that would be appreciated (particularly, code samples in nodejs / Javscript).

    Some more details ...
    I'm using Homebridge with the Homeseer plugin. Homebridge's HomeSeer plugin currently gets status updates by polling HomeSeer (by default, every 60 seconds). While polling works O.K. for devices where you don't need instant updates, its ineffective for things like a door contact sensor when you want to trigger events that occur instantly upon, e.g., opening the door. Of course, you could just poll rapidly, but then HomeSeer seems to become unresponsive. I'd like to modify the Homebridge Homeseer plugin so that it opens a channel to HomeSeer and then gets status updates over that channel whenever device values change.

    Is this possible?
    If you modify a plugin then the best thing to do is to register for a device value change callback, then when any device in HS changes string/value/status (you can select) you get a callback in your plugin and then can deal with the new value.

    In the event you don't want to modify the plugin then the best thing to look at is probably the ASCII interface (https://homeseer.com/support/homesee...nk/default.htm) which can be opened with a socket connection and you can get instant updates.

    Unfortunately my node.js experience is minimal at best but I imagine it might be fairly easy to open a socket and just parse the text results.

    Comment


      #3
      Would LOVE to get instant updates for contact and motion sensors! I think it's crazy more people don't wan't need this

      Comment


        #4
        Originally posted by jfandco View Post
        Would LOVE to get instant updates for contact and motion sensors! I think it's crazy more people don't wan't need this

        My homebridge plugin is now working with instant update and is available from npm as the package homebridge-homeseer-plugin-2018

        Comment


          #5

          Comment


            #6
            They've been completely removed. I'd be willing to try and re-implement, but as you guessed, its the testing that's a problem, particularly as I use an entirely different code architecture to monitor changes and update values. I think I could get the garage door opener working. I pretty easily -- would you be willing to test that separate from the "door" feature. I'll take a look at the code again - perhaps within the next few days.

            Another option (and one that would be pretty easy) is to modify the original plugin so it can be used at the same time as my changed one.

            Comment


              #7
              Would definitely be willing to test. Just let me know!

              Comment


                #8
                Wanted to post some install info in case anyone wants to give this a go.

                If installing this in Linux, you will need node version 7 and you will also need to install mdns. Took me a while to figure this out

                Here's the commands I used.

                Code:
                curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
                wget https://nodejs.org/dist/v6.9.5/node-v6.9.5-linux-armv6l.tar.xz
                tar xJvf node-v6.9.5-linux-armv6l.tar.xz
                sudo mkdir -p /opt/node
                sudo mv node-v6.9.5-linux-armv6l/* /opt/node/
                sudo update-alternatives --install "/usr/bin/node" "node" "/opt/node/bin/node" 1
                sudo update-alternatives --install "/usr/bin/npm" "npm" "/opt/node/bin/npm" 1
                sudo apt-get install libavahi-compat-libdnssd-dev
                sudo npm install -g --unsafe-perm homebridge
                cd /usr/lib/node_modules/homebridge
                sudo npm install --unsafe-perm mdns
                sudo npm rebuild --unsafe-perm
                sudo npm install -g homebridge-homeseer-plugin-2018

                Comment


                  #9
                  Linux-Thanks!

                  I'll add some info on Linux installation to the Readme page and wiki page.
                  I'll also update the node requirement in the packages so user's will know.
                  I've been using it on Node 8.6.

                  I will try to implement Garage Door Openers for you.

                  I could use some additional information since I don't have one on my system.

                  Here's what I'm looking for
                  1. A HomeSeer web page screen shot showing the group of devices set up by Homeseer. I think there should be at least a lock device, obstruction sensor device, possibly one to sense open/closed state, and a device to control whether to open or close the door.

                  For each of these devices, a screenshot of the device's "Status Graphics" page showing the values used by HomeSeer for status and/or control.

                  Comment


                    #10
                    Here you go. Let me know if you need anything else.









                    Comment


                      #11
                      In case you have time, here are the screenshots of door sensors.







                      Comment


                        #12
                        Thanks. I'll check this out but it may take a while.

                        In the meantime, I've implemented a fix to allow you to simultaneously use the new plugin with the old. That way, you can use the old plugin for your garage door opener or other devices I don't support.

                        Check the wiki entry at: https://github.com/jvmahon/homebridg...in-in-Parallel

                        Comment


                          #13
                          I also saw your message about implementing the 'door' sensor.

                          Maybe I was confused about what you wanted when you said you want the door implemented. In HomeKit a "door" service is for controlling the motion of a powered door and has characteristics like the current position, target position, and position state.

                          Your image suggest all you want is a contact sensor type device which shows up in HomeKit with a picture of a door.

                          For that, just use "type":"ContactSensor" in the Accessories section for homebridge-homeseer-plugin-2018. Then, from the iOS Home app, you just give a long-press on the device then choose "details" from the screen that appears, then choose "type" on the next screen where you can assign what the ContactSensor really relates to (e.g., door, window, garage door opener, blinds) and it will work.

                          More specifically, for your door sensor, all you need is an entry in the accessories group like:

                          "accessories":
                          [
                          { "type":"ContactSensor", "name":"Kitchen Door", "ref":86, "batteryRef":84, "batteryThreshold":20 }
                          ]
                          Last edited by jvm; February 28, 2018, 11:23 AM.

                          Comment


                            #14
                            My mistake. Door sensors (contact sensors) do work. For some reason they didn't work when first tried, they do now 👍

                            Comment


                              #15
                              Not sure if this helps but below is the config that was working with the previous homebridge plugin.

                              Code:
                              {
                              				"type": "GarageDoorOpener",
                              				"name": "Garage Door",
                              				"ref": 648,
                              				"stateRef": 648,
                              				"stateOpenValues": [255],
                              				"stateClosedValues": [0],
                              				"stateOpeningValues": [254],
                              				"stateClosingValues": [252],
                              				"stateStoppedValues": [253],
                              				"controlRef": 648,
                              				"controlOpenValue": 255,
                              				"controlCloseValue": 0
                              			},

                              Comment

                              Working...
                              X