Announcement

Collapse
No announcement yet.

HS3 <-> Node-RED. Best way to communicate between them?

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

    HS3 <-> Node-RED. Best way to communicate between them?

    So I just started playing with Node-RED to build a custom front-end for my Homeseer3.
    I have HS3 running on a Windows machine, and Node-RED currently on my linux desktop. Planning to move it to a RPi when completed.

    It is all promising so far and I've made good progress, but was wondering what would be the best way to exchange data between both systems.

    So far I'm using the JSON interface (http://HS3/JSON?request=getstatus/ge...icebylabel/etc). It works fine but the JSON payload is WAY bloated. It brings lots of unnecessary information. If I request status of all my 375 devices, the json data is 212kb. To make sure the status of switches and locks is up to date I should poll every few seconds which may be taxing for the machine running HS3. I haven't found a way of getting a JSON with just the status/value fields.

    There is also the REST API (http://HS3/HomeSeer_REST_API.aspx?fu...2&param2=value), which can provide just the value data without any extra content, but only for a single device so I'd have to make lots of separate calls to update the status of all devices on screen. This API also feels slower than the JSON one.

    Are those the only/best options to exchange data between these two systems? I've seen mentions of things like MQTT plugins/brokers and not sure how they fit in the scheme of things. So far I have MS3 and Node-RED talking directly, and not sure if other apps/layers inbetween would help or make the system slower/heavier.

    how are people handing these issues?

    #2
    MQTT is the typical mechanism to perform this interface. mcsMQTT HS3 plugin makes it easy and is free.

    Comment


      #3
      Originally posted by Michael McSharry View Post
      MQTT is the typical mechanism to perform this interface. mcsMQTT HS3 plugin makes it easy and is free.
      Thanks. Can mcsMQTT talk to Node-RED directly? Is mcsMQTT a "broker"? Or do I need to install another piece besides HS3,mcsMQTT and Node-RED?

      Comment


        #4
        mcsMQTT is a client. Mosquitto is the broker most use and can be installed on same platform as Node-Red, HS or anywhere else.

        Comment


          #5
          There should be a sticky somewhere on this forum which point to your .pdf file. Michael McSharry . Your document is really well made.

          But I don't have an idea where to put it. Maybe in the general -how to- thread ?

          Comment


            #6
            It is referenced at the sticky post at the top of the mcsMQTT forum. Two problems. One needs to be deep enough into it to recognize mcsMQTT (which is in Primary Lighting Section). Second is that folks don't like to read more than comes in a tweat or news snapshot and the document is more like a book. MQTT hits many areas so it difficult to characterize and put it in a place where users would tend to look.

            Prior to MQTT I did quite a bit with xAP which is a similar concept before IOT. Outside of Great Britain and France there was not much happening. HS is a central engine for decision making so the HS forum is not a good one for distributed or federated computing concepts.

            Comment


              #7
              I know this is a bit of an other thread. but i've been looking into a more direct way to integrate Node-Red with HS3. One way is to send JSON requests to HS3... for now, all i've figured out is that works great for controlling a device, but likely doesn't help me with seeing status changes of a device in node-red.
              Likely for bi-directional mcsMQTT is going to be the easiest solution until someone makes a plugin ... that said, for the most part events in HS3 are enough. I've been looking at Node-Red as a way to handle more complex scenarios, which scripting in HS3 can be difficult compared to Node-Red.

              Comment


                #8
                maybe you can look at big5 plugin ? https://forums.homeseer.com/forum/li.../big5-risquare

                it does http and mqtt

                Comment


                  #9
                  Originally posted by etobian View Post
                  So I just started playing with Node-RED to build a custom front-end for my Homeseer3.
                  I have HS3 running on a Windows machine, and Node-RED currently on my linux desktop. Planning to move it to a RPi when completed.

                  It is all promising so far and I've made good progress, but was wondering what would be the best way to exchange data between both systems.

                  So far I'm using the JSON interface (http://HS3/JSON?request=getstatus/ge...icebylabel/etc). It works fine but the JSON payload is WAY bloated. It brings lots of unnecessary information. If I request status of all my 375 devices, the json data is 212kb. To make sure the status of switches and locks is up to date I should poll every few seconds which may be taxing for the machine running HS3. I haven't found a way of getting a JSON with just the status/value fields.

                  There is also the REST API (http://HS3/HomeSeer_REST_API.aspx?fu...2&param2=value), which can provide just the value data without any extra content, but only for a single device so I'd have to make lots of separate calls to update the status of all devices on screen. This API also feels slower than the JSON one.

                  Are those the only/best options to exchange data between these two systems? I've seen mentions of things like MQTT plugins/brokers and not sure how they fit in the scheme of things. So far I have MS3 and Node-RED talking directly, and not sure if other apps/layers inbetween would help or make the system slower/heavier.

                  how are people handing these issues?
                  You need this : https://flows.nodered.org/node/node-red-dashboard and https://cookbook.nodered.org/mqtt/ === > http://www.steves-internet-guide.com...-publish-node/ . HomeSeer has mqtt plugins to help you complete the setup.



                  Eman.
                  TinkerLand : Life's Choices,"No One Size Fits All"

                  Comment


                    #10
                    Eman I agree, and plan to look into simply using MQTT to integrate for bi-directional.

                    etobian MQTT would solve your "polling" issue, as when a state changes in HS3, you have the mcsMQTT plugin (or whichever you choose for HS3) publish a Topic with the state change, which Node-Red can then do something with.
                    Same for when you need to change a state, Can have Node-Red publish to an MQTT topic and have HS3 pickup the change and do something.
                    Care must be taken you don't create an infinite loop.

                    Comment


                      #11
                      To avoid problems inside Node-RED, don't connect MQTT input nodes to MQTT output nodes

                      Ex. image below :

                      Click image for larger version

Name:	Nodered.png
Views:	806
Size:	127.7 KB
ID:	1287674




                      Eman.
                      TinkerLand : Life's Choices,"No One Size Fits All"

                      Comment


                        #12
                        Have you found a better way to do this yet? I've been looking... Ideally we need a plugin Inside HS3, that will send to a websocket or MQTT message on Update of ANY device (or better, a list of devices we provide to the plugin, as many of the related devices we don't need to send data about). Easiest would be to just send any change to any device in a HTTP or MQTT JSON formated endpoint of our choosing.

                        Anyone want to create that for us? i'd pay for the plugin. I can't get Big-5 to do it. mcsMQTT is awesome! but don't want to manually setup each and every device

                        Thanks

                        Comment


                          #13
                          You can auto associate all HS devices to MQTT topics. It is an option on the General tab. Make certain your default templates are setup as desired before enabling this option so you get the topic formats you want. The manual describes how to do this.

                          Comment


                            #14
                            Originally posted by Michael McSharry View Post
                            You can auto associate all HS devices to MQTT topics. It is an option on the General tab. Make certain your default templates are setup as desired before enabling this option so you get the topic formats you want. The manual describes how to do this.
                            AWESOME Thanks Michael, after i posted that message i've actually been reading through the manual again from top to bottom, haven't seen that yet!
                            Thanks again for a great plugin, you really should charge a nominal fee for it as its better than some i've paid for

                            Comment

                            Working...
                            X