Update helper status without triggering


I have an input boolean helper which I use to control something through Node-RED. If I switch it on, flow A is triggered and turns the device on, if I switch it off, flow B is triggered and turns the device off.

So far so good.

However, the device I am controlling can also be switched on/off by other means. I have also means to track the status through Node-RED.

What I am missing however, is a way to update the state in Home Assistant through Node-RED without triggering a new state change event.

While in many cases it might not matter much, especially if you run timed events based on the state switch, things can deliver unwanted results…

I migrated from OpenHAB where this could relativly easily be achived with the nodes having options for “command” and “update”. Is this functionality really not available or am I just looking in the wrong places?

You might have to reverse it a bit.

Right now you have an automation that triggers the scripts when the boolean helper change state.
Remove that automation and then have the script set the boolean helper as part of the script.

1 Like

Hmm, I am not sure how this would work. In that case I would use the function of manually turning on/off the switch myself, which is of course the core functionality…

Of course I could introduce a second helper (or a variable in Node-RED) and compare the real state with the intended state - but that doesn’t strike me as a particulary elegant solution.

I tried writing directly to the homeassistant global object, which does work - but changes nothing on the HA-side…

In HA the state change will always trigger the automation.
You can of course disabled the automation, then make the state change and then reenable the automation again.

Still the correct way would be to move the unlink the script, since it seems to be not wanted to run on all state changes,