Announcement

Collapse
No announcement yet.

Device Status (JSON/Plugin?)

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

  • Device Status (JSON/Plugin?)

    I recently got HSTouch and HSPRO3, but ran into some limitations. I decided to look into building a mobile UI using the JSON interface in the latest HS3 beta last night.

    So far it works for controlling devices, and getting my initial list/statuses.
    Next, I wanted to start handling status changes that are not done from my client. I could keep polling the devices visible on my screen, but that seems pretty inefficient. I was wondering if there's a recommendation for how to handle this.

    Should I setup an HS3 plugin with a socket connection that tells my client when there's an event, can I do some sort of long polling, or is there a better option I'm not thinking of?

    Any guidance would be appreciated.

    Thanks

  • #2
    If your client(s) will always be on the same local network, one approach that I have used very successfully is to write a simple plugin that does a UDP broadcast for every device change. Multiple clients can see a single broadcast packet, UDP is easy to code to, no hassle with dealing with disconnects. Include a sequence number in each packet and your clients will know if they missed a packet (something I rarely see).

    tenholde
    tenholde

    Comment


    • #3
      That seems like a pretty reasonable approach. I haven't written an HS plugin before, but assume it's not too complicated since I won't need any UI. Any tips before I start digging into that side?

      BTW as a side note of progress, I just got my ceiling fans animating and spinning around in my client based on the fan speed

      Comment


      • #4
        I'm looking for the same functionality. Controlling with JSON works fine, but the feedback from device status changes is missing. I've seen the same request in several other topics so more people seem to looking for a solution. I have a working plugin for HS2 doing exactly as Tenholde describes. It was not written by me and will not be ported by the writer of the plugin to HS3.

        I'm not able to write this plugin myself, but would be willing to pay for a plugin that provide status change feedback of devices over UDP in a JSON format.


        Sent from my iPad using Tapatalk

        Comment


        • #5
          Just out of curiosity, are you looking at all device updates being sent by UDP, or a user selectable list?

          Since i am very new to all of this I am not really able to code anything up, but wanted to ask the question as it may help someone who is able to.
          HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

          Facebook | Twitter | Flickr | Google+ | Website | YouTube

          Comment


          • #6
            I am willing to do this, as I will need the functionality in HS3 as I convert.

            Here is my thinking, please give me your thoughts:

            The HS3 plugin will catch EVERY device change and queue device info to send via UDP

            Every 1 second, the plugin will gather anything in the queue, and format and send a single UDP packet with individual sections for each device change

            The UDP packet will have a header that will contain an incrementing packet number (so the client knows if they missed a packet) and the count of device segments in the packet

            That's my thinking so far. Comments please.

            Anyone willing to design the JSON formatted packet?

            tenholde
            tenholde

            Comment


            • #7
              Sounds like something like this may already be coming. Take a look at this thread starting with post 75.

              Cheers
              Al
              HS 3.0.0.548: 1976 Devices 1156 Events
              Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

              Comment


              • #8
                Originally posted by tenholde View Post
                I am willing to do this, as I will need the functionality in HS3 as I convert.

                Here is my thinking, please give me your thoughts:

                The HS3 plugin will catch EVERY device change and queue device info to send via UDP

                Every 1 second, the plugin will gather anything in the queue, and format and send a single UDP packet with individual sections for each device change

                The UDP packet will have a header that will contain an incrementing packet number (so the client knows if they missed a packet) and the count of device segments in the packet

                That's my thinking so far. Comments please.

                Anyone willing to design the JSON formatted packet?

                tenholde
                I think if it's a UDP packet, the only info you would really need to include beyond the packet # (or a timestamp) would be the DeviceID that changed. That way the receiver could do whatever json query it needs or wants to find out the updated info.

                Also, I'm not sure why you'd want to only send messages queued up every second instead of immediately? I can't imagine a situation where there are so many device changes that they can't be sent right away via UDP, but perhaps I'm missing something?

                I'm not sure how that'd work with events though, my personal use right now was just for device status changes, but if someone wants more advanced event trigger notification, I have no idea how it'd need to work.

                Also Sparkmans comment looks promising too. It seems like it could fill this need, but I'm curious what the ETA is on that project and how supported it will be.

                Comment


                • #9
                  Out of curiosity, does anyone here think there'd be people interested in a basic package that lets you build a mobile control interface in Unity? I'm setting mine up in there so I can do more complex interactions and graphics (animating 3d models, etc) than what I can do in HSTouch, but it does require a bit of knowledge and probably won't have the full functionality HSTouch provides. If so, I may start posting packages somewhere on the board so people can try it out and build their own off of my prefabs.

                  Comment


                  • #10
                    Looks like the other app will do this as well, the only difference is that the other app requires a connection to be opened with the server, whereas this would push a UDP packet out which may reduce the strain on the HS3 server (albeit very slightly).
                    HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

                    Facebook | Twitter | Flickr | Google+ | Website | YouTube

                    Comment


                    • #11
                      If the functionality is in HS3 through the H2Z package, then that would eliminate the need for this plugin. The plugin I use today does send out UDP messages at the moment of any device status change. It's not collecting them to send them out every certain timeframe. I always understood that the advantage of the UDP method is that every controlling device receives the update on the same subnet. Not sure if multiple control devices can be connected to the same port to receive the updates in the H2Z functionality.


                      Sent from my iPad using Tapatalk

                      Comment

                      Working...
                      X