Home Assistant Community

Setting Thermostat Based on Sensor Value

#1

I’m relatively new to Home Assistant and have used Node Red for some simple automations. This one is probably simple too but I can’t wrap my head around it.

I have a variable rate electricity plan that changes every 5 minutes with a sensor that tracks the price. I have a quirky aros air conditioner that I want to adjust the temperature set point on based on the price of electricity.

So far I have automations that bump the temp up if the price is high, or bump it down if the price goes low but I can’t do anything in between because my automations end up contradicting each other.

What I would like to do is set temperature ranges for prices between my setpoints for example:
below 4¢ set temp to 68
between 4.1¢ and 8¢ set temp to 70
between 8.1¢ and 12¢ set temp to 72
above 12.1¢ set temp to 74

Any help would be appreciated, and feel free to spoon feed me. I will not be offended.

#2

Can you post your existing code?

#3

This is what I have now

[{"id":"63a30c7d.4c8404","type":"api-call-service","z":"3b63345.4e40ccc","name":"Set Master AC to 80","server":"66317cf8.fd11a4","service_domain":"climate","service":"set_temperature","data":"{\"entity_id\":\"climate.master_bedroom_a_c\",\"temperature\":80}","mergecontext":"","output_location":"","output_location_type":"none","x":440,"y":80,"wires":[[]]},{"id":"86888336.6b916","type":"server-state-changed","z":"3b63345.4e40ccc","name":"griddy <30","server":"66317cf8.fd11a4","entityidfilter":"sensor.griddy","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"30","halt_if_type":"","halt_if_compare":"lt","outputs":2,"output_only_on_state_change":true,"x":100,"y":100,"wires":[["63a30c7d.4c8404"],[]]},{"id":"56296159.2d191","type":"api-call-service","z":"3b63345.4e40ccc","name":"Set Master AC to 68","server":"66317cf8.fd11a4","service_domain":"climate","service":"set_temperature","data":"{\"entity_id\":\"climate.master_bedroom_a_c\",\"temperature\":68}","mergecontext":"","output_location":"","output_location_type":"none","x":420,"y":160,"wires":[[]]},{"id":"b3544ed2.2c70f","type":"server-state-changed","z":"3b63345.4e40ccc","name":"griddy >3","server":"66317cf8.fd11a4","entityidfilter":"sensor.griddy","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"3","halt_if_type":"","halt_if_compare":"gt","outputs":2,"output_only_on_state_change":true,"x":120,"y":180,"wires":[["56296159.2d191"],[]]},{"id":"66317cf8.fd11a4","type":"server","z":"","name":"Home Assistant"}]
#4

I was right, it was simple. I just needed a switch with multiple outputs and “between” values. :blush:

[{"id":"58b718a5.a56b38","type":"server-state-changed","z":"3b63345.4e40ccc","name":"griddy raw","server":"66317cf8.fd11a4","entityidfilter":"sensor.griddy","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"","halt_if_type":"","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":80,"y":360,"wires":[["7c51989c.2e5cd8"]]},{"id":"d99b9fc0.0c349","type":"api-call-service","z":"3b63345.4e40ccc","name":"Set Master AC to 68","server":"66317cf8.fd11a4","service_domain":"climate","service":"set_temperature","data":"{\"entity_id\":\"climate.master_bedroom_a_c\",\"temperature\":68}","mergecontext":"","output_location":"","output_location_type":"none","x":360,"y":340,"wires":[[]]},{"id":"7c51989c.2e5cd8","type":"switch","z":"3b63345.4e40ccc","name":"ranges","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"3","vt":"str"},{"t":"btwn","v":"3.1","vt":"num","v2":"7","v2t":"num"},{"t":"btwn","v":"7.1","vt":"num","v2":"10","v2t":"num"},{"t":"btwn","v":"10.1","vt":"num","v2":"12","v2t":"num"},{"t":"gt","v":"12.1","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":190,"y":460,"wires":[["d99b9fc0.0c349"],["2ead632d.a38a8c"],["db1a0102.00c41"],["f7371c05.08d26"],["fc363751.24b0c8"]]},{"id":"2ead632d.a38a8c","type":"api-call-service","z":"3b63345.4e40ccc","name":"Set Master AC to 70","server":"66317cf8.fd11a4","service_domain":"climate","service":"set_temperature","data":"{\"entity_id\":\"climate.master_bedroom_a_c\",\"temperature\":70}","mergecontext":"","output_location":"","output_location_type":"none","x":380,"y":400,"wires":[[]]},{"id":"db1a0102.00c41","type":"api-call-service","z":"3b63345.4e40ccc","name":"Set Master AC to 72","server":"66317cf8.fd11a4","service_domain":"climate","service":"set_temperature","data":"{\"entity_id\":\"climate.master_bedroom_a_c\",\"temperature\":72}","mergecontext":"","output_location":"","output_location_type":"none","x":380,"y":440,"wires":[[]]},{"id":"f7371c05.08d26","type":"api-call-service","z":"3b63345.4e40ccc","name":"Set Master AC to 74","server":"66317cf8.fd11a4","service_domain":"climate","service":"set_temperature","data":"{\"entity_id\":\"climate.master_bedroom_a_c\",\"temperature\":74}","mergecontext":"","output_location":"","output_location_type":"none","x":380,"y":500,"wires":[[]]},{"id":"fc363751.24b0c8","type":"api-call-service","z":"3b63345.4e40ccc","name":"Set Master AC to 80","server":"66317cf8.fd11a4","service_domain":"climate","service":"set_temperature","data":"{\"entity_id\":\"climate.master_bedroom_a_c\",\"temperature\":80}","mergecontext":"","output_location":"","output_location_type":"none","x":400,"y":560,"wires":[[]]},{"id":"66317cf8.fd11a4","type":"server","z":"","name":"Home Assistant"}]