Announcement

Collapse
No announcement yet.

Trigger current status/value message without having to update the device

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

    Trigger current status/value message without having to update the device

    I am eliminating the MQTT intermediate by installing the HS NodeRED node and talking directly to HS.

    The HS node only sends messages if a device changes, if nothing is happening it stays quiet. This is causing issues when restarting NodeRED dashboards because some of the UI elements are not updated until activated. (For example think of a text field STATUS that shows AWAY or AT HOME, the text field is populated by a device value. If the dashboard is restarted the field is not populated until the status of the device changes.)

    The MQTT plugin I previously used has an option to send a periodic update(every X minutes) of all associated devices and I am wondering how I can implement this in for the HS node.

    It would be nice to be able to trigger a device node to send a status/value message without having to update the associated device. For example, sending a message with payload "currentStatus" triggers a message on the output that provides the current status and value of the device. Using a inject node that fires at startup and regular intervals would solve for the fields that are not populated.

    #2
    see discussion here: https://github.com/HomeSeer/node-red...eseer/issues/3

    Comment


      #3
      Have you looked into Context Stores in Node Red? It saves variables to the system for access on reboot. This write-up may be helpful as well. I believe that may have been started prior to this being implemented in Node Red, though. The first link is to the official documentation.

      Karl
      Karl S
      HS4Pro on Windows 10
      1070 Devices
      56 Z-Wave Nodes
      104 Events
      HSTouch Clients: 3 Android, 1 iOS
      Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

      Comment


        #4
        PS: Here is the write-up from when Local Context Store was released
        Karl S
        HS4Pro on Windows 10
        1070 Devices
        56 Z-Wave Nodes
        104 Events
        HSTouch Clients: 3 Android, 1 iOS
        Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

        Comment


          #5
          Also, see Trigger a Flow whenever Node-Red Starts. In this solution you add an Inject node which runs a given number seconds after Node Red has started.

          Here is the JSON from the linked example, which you could import into a flow:
          Code:
          [{"id":"e60b12c1.93bb3","type":"inject","z":"535331d8.55c1f", "name":"","topic":"","payload":"Started!","payloadType":"str ","repeat":"","crontab":"","once":true,"x":140,"y":540,"wire s":[["9b1d7727.56d0f8"]]},{"id":"9b1d7727.56d0f8","type":"debug","z":"535331d8.55c1f ","name":"","active":true,"console":"false","complete":"fals e","x":410,"y":540,"wires":[]}]
          Click image for larger version

Name:	Annotation 2020-09-04 131429.png
Views:	557
Size:	26.5 KB
ID:	1416903
          Karl S
          HS4Pro on Windows 10
          1070 Devices
          56 Z-Wave Nodes
          104 Events
          HSTouch Clients: 3 Android, 1 iOS
          Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

          Comment


            #6
            Sorry for all the messages, but I just wrote up this on how to keep a Node-Red user interface sync'd with HomeSeer even when the Node Red server is off line when a device changes, which may help you as well.
            Karl S
            HS4Pro on Windows 10
            1070 Devices
            56 Z-Wave Nodes
            104 Events
            HSTouch Clients: 3 Android, 1 iOS
            Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

            Comment


              #7
              Thanks vor all replies, sorry for the delayed reply, it's been a busy week....

              I am familiar with the context store and the process of firing of a event when node red starts. However I believe it does not solve my issue because it requires NodeRed to be running. (please correct me if I misunderstood)

              Imagine the following scenario:
              • NodeRED is running and DeviceX is updated with a new value, let's say 50
              • The HS4 node sends a message that contains the new status
              • The new value (50) is stored in the context store on disk
              • NodeRed is switched off
              • HS4 keeps running and DeviceX is frequently updated and at some time set to 100
              • NodeRed is started again
              • The inject flow triggers and restores the last known value from file: 50 and of course this is not correct because a lot has happened since.
              The issue is that NodeRed is not aware of changes in HS4 devices if it is off. The only way to solve this is:
              1. Send a periodic status update of all devices, which will generate a lot of trafic and is always "too late" -or-
              2. Have a way to ask the status of a device or range of devices. Think of a command you can issue like STATUS 400 that will return the current status of the device referenced (400) or even better something like STATUS 100-200;400;500 to also include ranges.

              François


              Comment


                #8
                Originally posted by fvhemert View Post
                Thanks vor all replies, sorry for the delayed reply, it's been a busy week....

                I am familiar with the context store and the process of firing of a event when node red starts. However I believe it does not solve my issue because it requires NodeRed to be running. (please correct me if I misunderstood)

                Imagine the following scenario:
                • NodeRED is running and DeviceX is updated with a new value, let's say 50
                • The HS4 node sends a message that contains the new status
                • The new value (50) is stored in the context store on disk
                • NodeRed is switched off
                • HS4 keeps running and DeviceX is frequently updated and at some time set to 100
                • NodeRed is started again
                • The inject flow triggers and restores the last known value from file: 50 and of course this is not correct because a lot has happened since.
                The issue is that NodeRed is not aware of changes in HS4 devices if it is off. The only way to solve this is:
                1. Send a periodic status update of all devices, which will generate a lot of trafic and is always "too late" -or-
                2. Have a way to ask the status of a device or range of devices. Think of a command you can issue like STATUS 400 that will return the current status of the device referenced (400) or even better something like STATUS 100-200;400;500 to also include ranges.

                François

                Doesn't that sound similar to this here? : https://github.com/HomeSeer/node-red-contrib-homeseer at the bottom "Reporting Device current state" and there is also : https://github.com/HomeSeer/node-red...-current-state


                Note : there was an update!

                spud In version 1.0.4 I have added "sync"and "report" options as discussed in the github thread.
                Please test and let me know.


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

                Comment


                  #9
                  Fast times....you close your eyes and get what you are asking for

                  Forcing a Device update
                  If the node receives a message with msg.topic set to sync it will get the current state of the device from HomeSeer and send it to its output in msg.payload even if no changes has occured since the last update.

                  Seems to be doing exactly what I want, getting an update on demand.I will test this week, never noticed the new sync functionality.

                  Thanks!

                  Comment


                    #10
                    Also note that when node red starts, HomeSeer gets the current status of devices on the flow. This happened before the last update which added the sync and report. So running a flow shortly after start would have the latest values as listed I'm HomeSeer. No need for any special call to sync.
                    Last edited by ksum; September 14, 2020, 06:32 AM. Reason: Typo
                    Karl S
                    HS4Pro on Windows 10
                    1070 Devices
                    56 Z-Wave Nodes
                    104 Events
                    HSTouch Clients: 3 Android, 1 iOS
                    Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                    Comment

                    Working...
                    X