Coming from Smartthings, I heavily used modes as well. To carry that over, I created an “Input Select”, Input Select - Home Assistant with defined modes of Away, Home, and Night. My Node Red automations heavily use these modes, as both conditions and triggers. Other automations change and set those modes based on presence, time of day, etc.
You would do a call service node, and in the data field, choose the {} for JSON in the drop down, and then convert the YAML required by the call service to JSON. The key with Node red is it uses JSON, while Home Assistant uses YAML. You can use a YAML to JSON converter like this - Transform YAML into JSON - Online YAML Tools and it would look like this:
{
"target_temp_high": 80,
"target_temp_low": 66,
"hvac_mode": "heat"
}
Probably better ways to do this then the example I’m showing, but I have a similar situation with heat tape that turns on and off in the winter when the temperature falls and goes over 38 degrees:
First, I created an input boolean called input_boolean.above_38
Temperature is updated constantly, and I didn’t want it to keep triggering the automation every time temperature updated. I only wanted to trigger once as it rose and fell under the threashold. To get this to work, I took the continuous input from the sensor.openweathermap_temperature and used it to turning the above_38 boolean on and off as the temperature rises and falls.
Then automations are done off that boolean going on and off.
Flow code
[{"id":"548b3df1d66be332","type":"server-state-changed","z":"b1085131afd3723b","name":"Above 38","server":"ae531ce.a39906","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.openweathermap_temperature","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"38","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":130,"y":1420,"wires":[["1206487dc5b68629"],["df557a296ab67612"]]},{"id":"1206487dc5b68629","type":"api-call-service","z":"b1085131afd3723b","name":"Above 38","server":"ae531ce.a39906","version":3,"debugenabled":false,"service_domain":"input_boolean","service":"turn_on","entityId":"input_boolean.above_38","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":290,"y":1400,"wires":[[]]},{"id":"df557a296ab67612","type":"api-call-service","z":"b1085131afd3723b","name":"Under 38","server":"ae531ce.a39906","version":3,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.above_38","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":290,"y":1460,"wires":[[]]},{"id":"7c46b25b6cb0242f","type":"server-state-changed","z":"b1085131afd3723b","name":"Rise Above 38","server":"ae531ce.a39906","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.above_38","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":1560,"wires":[["341f95164805f740"],["12e38fa95087d944"]]},{"id":"341f95164805f740","type":"api-current-state","z":"b1085131afd3723b","name":"Winter?","server":"ae531ce.a39906","version":2,"outputs":2,"halt_if":"winter","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.season","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":350,"y":1520,"wires":[["8b04e07eb0999c93"],[]]},{"id":"8b04e07eb0999c93","type":"api-current-state","z":"b1085131afd3723b","name":"Heat Tape?","server":"ae531ce.a39906","version":2,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.heat_tape","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":520,"y":1520,"wires":[["edc362bcc3194827"],[]]},{"id":"edc362bcc3194827","type":"api-call-service","z":"b1085131afd3723b","name":"Outdoor Plug Off","server":"ae531ce.a39906","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.outdoor_plug","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":740,"y":1520,"wires":[[]]},{"id":"fd30d58db7221b77","type":"api-call-service","z":"b1085131afd3723b","name":"Outdoor Plug On","server":"ae531ce.a39906","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.outdoor_plug","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":1600,"wires":[[]]},{"id":"848ab4b5b1196700","type":"api-current-state","z":"b1085131afd3723b","name":"Heat Tape?","server":"ae531ce.a39906","version":2,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.heat_tape","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":520,"y":1600,"wires":[["3368af4e682a3d40"],[]]},{"id":"12e38fa95087d944","type":"api-current-state","z":"b1085131afd3723b","name":"Winter?","server":"ae531ce.a39906","version":2,"outputs":2,"halt_if":"winter","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.season","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":350,"y":1600,"wires":[["848ab4b5b1196700"],[]]},{"id":"3368af4e682a3d40","type":"time-range-switch","z":"b1085131afd3723b","name":"Daytime","lat":"43.10522","lon":"-78.80427","startTime":"sunrise","endTime":"sunset","startOffset":0,"endOffset":0,"x":690,"y":1600,"wires":[["fd30d58db7221b77"],[]]},{"id":"ae531ce.a39906","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]