Announcement

Collapse
No announcement yet.

Node-red gives double update bug.

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

    Node-red gives double update bug.

    FOR NOW SOLVED WITH A WORKARROUND
    https://flows.nodered.org/node/node-...ntrib-throttle







    Hi guys,

    Well since i checked my influxdb i did see double value's all the time after a status and value gets updated by 1 device.

    I have a virtual device in homeseer that updates now and then together the value's (status and Value)
    So when it updates and i check the output in node-red it triggers 2x, 1 time for status and one time for value in a second..

    is there a way to get rid of it?
    It kinda messes up my database now.


    its setup for testing like this:
    HOMESEERDEVICE ----> DebugWindow msg.payload.


    regards



    Code:
    10/26/2020, 10:07:38 AM[URL="http://192.168.1.12:1880/#"]node: GASTEST[/URL]msg.payload : Object
    object
    ref: 3399
    name: "YESTERDAY"
    location: "Gas Total"
    location2: "Gas Check"
    value: 3.069
    status: "3.068"
    last_change: "/Date(1603703259852+0100)/"
    10/26/2020, 10:07:38 AM[URL="http://192.168.1.12:1880/#"]node: GASTEST[/URL]msg.payload : Object
    object
    ref: 3399
    name: "YESTERDAY"
    location: "Gas Total"
    location2: "Gas Check"
    value: 3.069
    status: "3.069"
    last_change: "/Date(1603703259857+0100)/"
    Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
    Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




    HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

    #2
    Can you uncheck the Node's (HS Device) status reporting back to Node-RED

    Or you may need to include RBE node in your setup.


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

    Comment


      #3
      Originally posted by Eman View Post
      Can uncheck the Node's (HS Device) status reporting back to Node-RED

      Or you may need to include RBE node in your setup.


      Eman.
      Hi Eman,

      well i did try what you said, i added the RBE event and set it up like this (block unless value changes - payload.status)
      For now it works, so value and status have both same value.

      But i don't think i can trust on that..

      What i don;t understand, all plugins in homeseer what update status and value at same time do not trigger double...

      Does it have something to do how i build my scripts to update the value and string data ?



      this way is what i have in all my scripts to update the data:

      Dim Ref
      Ref = hs.GetDeviceRef("PWR-YDAY-GAS")
      hs.SetDeviceValueByRef(Ref, data True)
      hs.SetDeviceString (Ref,data, True)
      Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
      Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




      HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

      Comment


        #4
        Malosa .
        Does it have something to do how i build my scripts to update the value and string data ?
        If you are interested in values only remove the string
        And also you have string only as well

        You can have a device with value and string or one of each

        Click image for larger version  Name:	Status.png Views:	0 Size:	25.3 KB ID:	1428739


        Note: You can use a switch node to filter out the conditions that suit you and then when condition reach the change node, this is where it doesn't matter what's coming in, you can mold it to your heart's desire.


        More on that here : https://forums.homeseer.com/forum/homeseer-products-services/cloud-service-integrations/node-red/1417758-when-to-use-a-switch-node-as-a-fllter and https://forums.homeseer.com/forum/ho...ow-switch-node


        Tip : Always include a screenshot people can quickly understand you better.



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

        Comment


          #5
          Originally posted by Eman View Post

          If you are interested in values only remove the string
          And also you have string only as well

          You can have a device with value and string or one of each

          Click image for larger version Name:	Status.png Views:	0 Size:	25.3 KB ID:	1428739


          Note: You can use a switch node to filter out the conditions that suit you and then when condition reach the change node, this is where it doesn't matter what's coming in, you can mold it to your heart's desire.


          More on that here : https://forums.homeseer.com/forum/homeseer-products-services/cloud-service-integrations/node-red/1417758-when-to-use-a-switch-node-as-a-fllter and https://forums.homeseer.com/forum/ho...ow-switch-node


          Tip : Always include a screenshot people can quickly understand you better.



          Eman
          hi thanks,

          but the thing is why it works with plugin devices ?
          And with scripts it does not work at all..

          The problem i use all the info that is in msg.payload

          I just want to get rid of the double triggering all the time.
          I need status and value, aswell all the other info.

          the RBE does work, but it will only update only one of them instead of them both, so i have 2 different value's in influxdb.

          For me it now looks Node-Red triggers faster than homeseer changes value

          Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
          Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




          HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

          Comment


            #6
            Malosa ,
            For me it now looks Node-Red triggers faster than homeseer changes value
            This could be the case but until you show people your setup it's hard to blindly follow up but from what I can guess, do you have Graphana In HomeSeer?

            If so can you separate it and move it to the Node-RED side (I never played with this but it seems a good guide : https://www.hackster.io/naresh-krish...grafana-8960d3)
            • So if you have a similar project then you would have branch off nodes which report into HomeSeer HS Device nodes reflecting that data of which you would want triggers in HomeSeer.

            ksum or someone could help you with is node : https://flows.nodered.org/node/node-...trib-msg-speed and the Delay node : https://www.hardill.me.uk/wordpress/...ly-pause-node/




            How is that?


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

            Comment


              #7
              ‚ÄčClick image for larger version  Name:	 Views:	0 Size:	217.3 KB ID:	1428749 here is my screenshot


              the devices are virtual and triggered from my script, you see it triggers 2x because the value takes 1ms longer to update and sometimes status

              But when i change that device to a homeseer plugin device for example (plugwise plugin with the device name p1 total), it triggers 1x with status and value) and the status and value are updated the same in homeseer.. so no delay.



              See plugin device, it works normal


              Attached Files
              Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
              Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




              HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

              Comment


                #8
                On this latest post you could use some switch nodes like mentioned earlier to split the incoming messages before the change nodes.

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

                Comment


                  #9
                  Originally posted by Eman View Post
                  On this latest post you could use some switch nodes like mentioned earlier to split the incoming messages before the change nodes.

                  Eman.
                  Thanks, look the new last screenshot, that works normal if using device from a plugin


                  Could you show me a example how i can manage that?
                  i don't know how to.. i did try many times but won't work
                  if i change the type of payload structure, it won't be imported to influxdb, i'm using homeseer default payload.

                  this is my flow

                  Code:
                  [{"id":"af78b58d.e30c78","type":"debug","z":"339bf99d.7661a6","name":"GASTEST","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1070,"y":540,"wires":[]},{"id":"162e588f.e92317","type":"change","z":"339bf99d.7661a6","name":"Gas Daily Total","rules":[{"t":"change","p":"payload.name","pt":"msg","from":"payload.name","fromt":"msg","to":"Gas Daily Total","tot":"str"},{"t":"delete","p":"payload.status","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":400,"wires":[["af78b58d.e30c78"]]},{"id":"1193c6eb.6b0839","type":"hs-device","z":"339bf99d.7661a6","name":"Gas live used yesterday total","device":"3399","server":"96a5e48b.053628","feature":0,"reportonstartup":false,"x":140,"y":400,"wires":[["162e588f.e92317"]]},{"id":"96a5e48b.053628","type":"hs-server","z":"","name":"test","host":"192.168.1.12","port":"80"}]
                  Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
                  Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




                  HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

                  Comment


                    #10
                    OK,
                    I have moved away from my desktop but at my post #5 there are 2 links that I posted. They're are a good explanation of how to use a switch node as a filter. They will help you in what information you want to pass through by separating status from values so you put RBE nodes on each. So there neither is blocked before they each fire again.

                    In other words "Status" gets its own nodes and so does "value"


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

                    Comment


                      #11
                      Originally posted by Malosa View Post

                      What i don;t understand, all plugins in homeseer what update status and value at same time do not trigger double...

                      Does it have something to do how i build my scripts to update the value and string data ?



                      this way is what i have in all my scripts to update the data:

                      Dim Ref
                      Ref = hs.GetDeviceRef("PWR-YDAY-GAS")
                      hs.SetDeviceValueByRef(Ref, data True)
                      hs.SetDeviceString (Ref,data, True)
                      The difference is that most plugins do not update the device's string explicitly, they only set the device value which automatically update the device status unless the device's string is not empty.
                      For example if your device has a range of [0; 100], and you set the device value to 30, the status of the device will be automatically set to "30" at the same time.

                      Comment


                        #12
                        Originally posted by spud View Post

                        The difference is that most plugins do not update the device's string explicitly, they only set the device value which automatically update the device status unless the device's string is not empty.
                        For example if your device has a range of [0; 100], and you set the device value to 30, the status of the device will be automatically set to "30" at the same time.

                        thats true,

                        but its just weird that devices updated from my script gives a 1ms delay on value/string in node-red that causes a double payload.
                        and the plugin-devices from plugwise they update string and value same time after change.. so its not different than my script does.
                        but node-red get an delay when triggered by script, and by plugin no delay at all..

                        regards
                        Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
                        Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




                        HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

                        Comment


                          #13
                          I have found a thing that helps me out for now.
                          u can set it up that it will only trigger every second message in 2 seconds

                          https://flows.nodered.org/node/node-...-timed-counter

                          and it works good for now, i will test it out till HST has fixed the issue.

                          Many thanks for the help Eman
                          Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
                          Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




                          HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.

                          Comment


                            #14
                            Cool!

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

                            Comment


                              #15
                              There is also the Throttle contrib which can limit passing messages to once every X seconds. So setting it to 10 seconds means it only passes a message once every 10 seconds.
                              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