How to change the values inside a switch node via HA

I am using a node red flow to control the temperature in my tortoise shelter. If the temperature falls under a certain value a heat lamp will be turned on and if it rises over another value the lamp will be turned off again. The values are set in a switch node which is working great, but now I want to be able to change these values via Lovelace in HA. I already tried to use an input_number helper to set these values but just can’t figure how to get these into my switch. Is it possible to change values inside of a switch node or am I on the wrong track at all?

When I get this done I will be able to make the next step and create an automation which smoothly sends them into hibernation when fall ends und wake 'em up in spring.

Why make it so hard?
Use a thermostat:

Generic Thermostat - Home Assistant (home-assistant.io)

Just set the min and max temp and it will toggle the light for you

Thanks. I will have a look on this one. But since I’d like to stick to my existing flow and upgrade it I will first wait and see if there will be other ideas.

The thermostat doesn’t seem to work with more than a single heater entity. When this is correct it won’t work for me as I will have to use a ceramic heater instead of the lamp during the nights.

You should post your flow when asking for ways to improve it. Sounds like you will need to use separate event state nodes for the on off trigger. Then the temperature when it triggers can be adjusted with an input boolean with J;expression and $number($entities("input_number.temp_set_point").state)

image

Do you need to change the value within the switch node, or just reference it as a variable like this?:

Oh I didn’t realize that globals were available. You can pull the value from home assistant’s global states using

homeassistant.homeAssistant.states["input_number.temp_set_point"].state

It does work with multiple entities but you need to switch a generic/dummy switch which triggers an automation to switch the multiple entities you want to switch.

I have that in our living room.
One temperature sensor, two TRVs on the radiators and only one generic thermostat controlling it all

This one has solved it. Thanks to you!

Here’s my flow for everbody who’s interested:

[{"id":"b4f7b0b8.7bb9f8","type":"tab","label":"Schildkröten Automation","disabled":false,"info":""},{"id":"3389c9c8.74a64e","type":"switch","z":"b4f7b0b8.7bb9f8","name":"Warm oder kalt?","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"uppertempday","vt":"global"},{"t":"lt","v":"midtempday","vt":"global"},{"t":"lt","v":"lowertempday","vt":"global"}],"checkall":"true","repair":false,"outputs":3,"x":620,"y":140,"wires":[["9a8db627.6dcb3","bfbcf1bc.95095"],["b0c3b017.1d3578"],["e874821a.471528","b0c3b017.1d3578"]]},{"id":"58287db0.b9c094","type":"debug","z":"b4f7b0b8.7bb9f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":390,"y":240,"wires":[]},{"id":"9a8db627.6dcb3","type":"api-current-state","z":"b4f7b0b8.7bb9f8","name":"Lampe an oder aus?","server":"86616542.19f378","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.smart_outdoor_plug_mss620_switch_1","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":880,"y":60,"wires":[["caf0a08c.adb5b8"],[]]},{"id":"322e11d5.32dbe6","type":"time-range-switch","z":"b4f7b0b8.7bb9f8","name":"Tag oder Nacht","lat":"52.039453","lon":"7.477365","startTime":"sunriseEnd","endTime":"sunset","startOffset":0,"endOffset":0,"x":400,"y":300,"wires":[["3389c9c8.74a64e"],["79c77414.9b3e0c"]]},{"id":"caf0a08c.adb5b8","type":"api-call-service","z":"b4f7b0b8.7bb9f8","name":"Lampe ausschalten","server":"86616542.19f378","version":5,"debugenabled":true,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.smart_outdoor_plug_mss620_switch_1"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1210,"y":200,"wires":[[]]},{"id":"bfbcf1bc.95095","type":"api-current-state","z":"b4f7b0b8.7bb9f8","name":"Keramikstrahler an oder aus?","server":"86616542.19f378","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.smart_outdoor_plug_mss620_switch_2","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":890,"y":120,"wires":[["ecb6e973.c2cad"],[]]},{"id":"ecb6e973.c2cad","type":"api-call-service","z":"b4f7b0b8.7bb9f8","name":"Keramikstrahler ausschalten","server":"86616542.19f378","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.smart_outdoor_plug_mss620_switch_2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1220,"y":320,"wires":[[]]},{"id":"513c7bc8.2a282c","type":"api-call-service","z":"b4f7b0b8.7bb9f8","name":"Lampe einschalten","server":"86616542.19f378","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.smart_outdoor_plug_mss620_switch_1"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1210,"y":140,"wires":[[]]},{"id":"dbea14c9.1b85","type":"api-call-service","z":"b4f7b0b8.7bb9f8","name":"Keramikstrahler einschalten","server":"86616542.19f378","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.smart_outdoor_plug_mss620_switch_2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1220,"y":260,"wires":[["85f161d1.7eddc"]]},{"id":"79c77414.9b3e0c","type":"switch","z":"b4f7b0b8.7bb9f8","name":"Warm oder kalt?","property":"payload","propertyType":"msg","rules":[{"t":"nnull"},{"t":"lt","v":"lowertempnight","vt":"global"},{"t":"gte","v":"uppertempnight","vt":"global"}],"checkall":"true","repair":false,"outputs":3,"x":620,"y":360,"wires":[["665b7dfb.fc8ce4"],["e6643818.b040c"],["2a2a29c0.4f6c36"]]},{"id":"b0c3b017.1d3578","type":"api-current-state","z":"b4f7b0b8.7bb9f8","name":"Lampe an oder aus?","server":"86616542.19f378","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.smart_outdoor_plug_mss620_switch_1","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":880,"y":180,"wires":[[],["513c7bc8.2a282c"]]},{"id":"e874821a.471528","type":"api-current-state","z":"b4f7b0b8.7bb9f8","name":"Keramikstrahler an oder aus?","server":"86616542.19f378","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.smart_outdoor_plug_mss620_switch_2","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":890,"y":240,"wires":[[],["dbea14c9.1b85"]]},{"id":"e6643818.b040c","type":"api-current-state","z":"b4f7b0b8.7bb9f8","name":"Keramikstrahler an oder aus?","server":"86616542.19f378","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.smart_outdoor_plug_mss620_switch_2","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":890,"y":360,"wires":[[],["dbea14c9.1b85"]]},{"id":"2a2a29c0.4f6c36","type":"api-current-state","z":"b4f7b0b8.7bb9f8","name":"Keramikstrahler an oder aus?","server":"86616542.19f378","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.smart_outdoor_plug_mss620_switch_2","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":890,"y":420,"wires":[["ecb6e973.c2cad"],[]]},{"id":"665b7dfb.fc8ce4","type":"api-current-state","z":"b4f7b0b8.7bb9f8","name":"Lampe an oder aus?","server":"86616542.19f378","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.smart_outdoor_plug_mss620_switch_1","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":880,"y":300,"wires":[["caf0a08c.adb5b8"],[]]},{"id":"f3f5cde9.757828","type":"poll-state","z":"b4f7b0b8.7bb9f8","name":"Schildkröten Temperatur","server":"86616542.19f378","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"30","updateIntervalType":"num","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":true,"entity_id":"sensor.schildkrotengehege_temperatur","state_type":"num","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":150,"y":280,"wires":[["322e11d5.32dbe6","58287db0.b9c094"]]},{"id":"46a2955f.e94dac","type":"stoptimer","z":"b4f7b0b8.7bb9f8","duration":"1","units":"Hour","payloadtype":"num","payloadval":"0","name":"","x":1690,"y":220,"wires":[["450799ae.7a5c4","e63e3b7c.6363f8"],[]]},{"id":"450799ae.7a5c4","type":"switch","z":"b4f7b0b8.7bb9f8","name":"Warm oder kalt?","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"14","vt":"str"},{"t":"lt","v":"14","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1480,"y":260,"wires":[["ecb6e973.c2cad"],["46a2955f.e94dac"]]},{"id":"85f161d1.7eddc","type":"time-range-switch","z":"b4f7b0b8.7bb9f8","name":"Tag oder Nacht","lat":"52.039453","lon":"7.477365","startTime":"sunriseEnd","endTime":"sunset","startOffset":0,"endOffset":0,"x":1480,"y":200,"wires":[[],["46a2955f.e94dac"]]},{"id":"e63e3b7c.6363f8","type":"debug","z":"b4f7b0b8.7bb9f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1890,"y":220,"wires":[]},{"id":"c2870d4adf82c8df","type":"server-state-changed","z":"b4f7b0b8.7bb9f8","name":"Upper Temp Day","server":"86616542.19f378","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.temperatur_schildkroten_tagsuber_maximum","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"uppertempday","propertyType":"global","value":"","valueType":"entityState"}],"x":380,"y":60,"wires":[["3389c9c8.74a64e"]]},{"id":"586fd7a53a22b3c5","type":"server-state-changed","z":"b4f7b0b8.7bb9f8","name":"Mid Temp Day","server":"86616542.19f378","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.temperatur_schildkroten_tagsuber_medium","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"midtempday","propertyType":"global","value":"","valueType":"entityState"}],"x":370,"y":120,"wires":[["3389c9c8.74a64e"]]},{"id":"f2c76250acabe2e0","type":"server-state-changed","z":"b4f7b0b8.7bb9f8","name":"Lower Temp Day","server":"86616542.19f378","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.temperatur_schildkroten_tagsuber_minimum","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"lowertempday","propertyType":"global","value":"","valueType":"entityState"}],"x":380,"y":180,"wires":[["3389c9c8.74a64e"]]},{"id":"5a73e9aa9bcddf1f","type":"server-state-changed","z":"b4f7b0b8.7bb9f8","name":"Upper Temp Night","server":"86616542.19f378","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.temperatur_schildkroten_nachts_maximum","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"uppertempnight","propertyType":"global","value":"","valueType":"entityState"}],"x":390,"y":420,"wires":[["79c77414.9b3e0c"]]},{"id":"d8b644ae9e1bb2cc","type":"server-state-changed","z":"b4f7b0b8.7bb9f8","name":"Lower Temp Night","server":"86616542.19f378","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.temperatur_schildkroten_nachts_minimum","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"lowertempnight","propertyType":"global","value":"","valueType":"entityState"}],"x":390,"y":360,"wires":[["79c77414.9b3e0c"]]},{"id":"86616542.19f378","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]