Node-Red ignore state changes

Hi all,

Getting to know Node-Red and it's integration with HE. I am trying to work on a flow where it checks the state of a switch/light and then a switch node either stops if the light is already on or continues to turn the light on. I have used the device node which shows the state, but if I continue the flow and turn that light on, then the state changes in the device node and causes a loop that flicks the light on and off for ever until i remove the nodes and redeploy. Is there a way to capture the state of the light when the flow is started and not change it when the light goes on? Or am I thinking badly and missing something simple? or have I got a bug?

This is my flow:

Thanks
James

Change the device node to not "send events". Then it will only update/send when it receives an incoming message.

6 Likes

Be prepared for that little checkbox to continue to cause problems moving forward. I forget to uncheck it ALL THE TIME!!!!! However, there is good news, when you uncheck Send Events, the blue box under the node will be hollow so you will be able to tell without opening the node's edit form whether you remembered to uncheck the Send Events box. That's how @JasonJoel could quickly tell you the problem by looking at your flow.

4 Likes

@james7 - just to illustrate @stephen_nutt's explanation:

Screen Shot 2020-11-13 at 2.52.00 PM

5 Likes

Amazing @JasonJoel @stephen_nutt @aaiyar

I did see that box, and promptly ignored it, now I look at it, it makes sense!! Looks like it working how it should. Now to get it all wired in and working.

Thanks again

James

4 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.