How to trigger node red from all light entity changes (state, brightness, color temp)

I have a mode manager for my lights made with input_select. One of the options is “manual” (or “käsiajo” in this example). Light settings are built in node red.

I want all lights to be controlled from this mode manager. It basically has few preselected scenes we are using. I also have a lovelace page to manually change light values. When this happens I want the mode manager to go to “manual/käsiajo”.

I achieved this functionality when the state changes. Meaning lights go on or off. But someone might as well change the brightness only and later on use the mode manager to get to previous scene. In this case the mode manager value was not changed and it indicates already the wanted mode but the lights are wrong. Is this understandable? :smiley:


To walk this through. The first node is called when I want living room light to be changed to any state, brightness etc. “state_changed: light.olohuone” is triggered when the actual light changes. Output from this goes with 3 second delay to service node that sets my mode manager to manual. Unless node red was issuing the command, then this 3 second delay is reseted and mode manager stays where it was.

This catches nicely any “manual” state change operations made from the lovelace view.

Is there a way to trigger node red on all changes? State, brightness and color temperature?

The flow below:

[{"id":"e6959441.645348","type":"api-call-service","z":"962a4a1a.92a1e8","name":"Living room (HUE group)","server":"cb4d1ac7.a85f48","version":1,"debugenabled":false,"service_domain":"light","service":"","entityId":"light.olohuone","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":970,"y":900,"wires":[["9b97ebaf.3884b8"]]},{"id":"653427f1.e86228","type":"server-state-changed","z":"962a4a1a.92a1e8","name":"","server":"cb4d1ac7.a85f48","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"light.olohuone","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":1360,"y":880,"wires":[["de61d3ba.567f7"]]},{"id":"1dc2c12.687af3f","type":"api-call-service","z":"962a4a1a.92a1e8","name":"","server":"cb4d1ac7.a85f48","version":1,"debugenabled":false,"service_domain":"input_select","service":"select_option","entityId":"input_select.scene_selector_kitchen_livingroom","data":"{\"option\":\"Käsiajo\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1830,"y":900,"wires":[[]]},{"id":"de61d3ba.567f7","type":"trigger","z":"962a4a1a.92a1e8","op1":"","op2":"","op1type":"nul","op2type":"date","duration":"3","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":1580,"y":900,"wires":[["1dc2c12.687af3f"]]},{"id":"6ad92ea5.48379","type":"function","z":"962a4a1a.92a1e8","name":"reset","func":"msg.reset = true;\n\nreturn msg;\n","outputs":1,"noerr":0,"x":1430,"y":940,"wires":[["de61d3ba.567f7"]]},{"id":"9b97ebaf.3884b8","type":"delay","z":"962a4a1a.92a1e8","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1280,"y":940,"wires":[["6ad92ea5.48379"]]},{"id":"cb4d1ac7.a85f48","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false}]

Untick the box output on state change
Any change will then output

1 Like

Woah, that was easy! Thanks!