I created a climate controller in ESPHome (a “Dual-point” thermostat) to control the temperature of the room with AC and Heating hooked up to it. I also want to create a scenario, where the (I’ve purchased a light sensor that measures the lux) light sensor will hit the max threshold (600lux) and (>600lux as the sun is shining through my window) and would immediately turn on the air conditioning system to hit the lower point of the dual point thermostat. I’m not sure though if it can be implemented and just overwriting the climate controller in HA. Any help would be appreciated!
Here is my code for turning the AC on
alias: light max threshold AC on
trigger:
- platform: numeric_state
entity_id: sensor.lux
attribute: unit_of_measurement
above: '600'
condition:
- condition: state
entity_id: climate.thermostat_climate_controller
attribute: target_temp_low
state: 'ON'
action:
- service: climate.set_hvac_mode
data:
hvac_mode: cool
target:
entity_id: climate.thermostat_climate_controller
mode: single
but i don’t know how to return to normal heating/cooling state…
I would surprised to learn that Numeric State Trigger works the way you expect. You made it monitor the value of the unit_of_measurement
attribute which never changes and is not a numeric value.
So i have to change it to
alias: light max threshold AC on
trigger:
- platform: numeric_state
entity_id: sensor.lux
above: '600'
condition:
- condition: state
entity_id: climate.thermostat_climate_controller
attribute: target_temp_low
state: 'ON'
action:
- service: climate.set_hvac_mode
data:
hvac_mode: cool
target:
entity_id: climate.thermostat_climate_controller
mode: single
in order to work and add a second automation to return to normal mode?
I doubt the State Condition is correct. You made it check if the value of the target_temp_low
attribute is ON
.
I want to achieve ‘target_temp_low’ when i reach 600lux of light. I’m really noob in configuring HA, so my code is not the best as you can see.
Is this what you want?
The automation is triggered when the value of sensor.lux
increases above the threshold of 600
. It then sets the climate entity to cool
mode and the setpoint temperature to whatever value is stored in the target_temp_low
attribute.
alias: light max threshold AC on
trigger:
- platform: numeric_state
entity_id: sensor.lux
above: 600
condition: []
action:
- service: climate.set_temperature
target:
entity_id: climate.thermostat_climate_controller
data:
temperature: "{{ state_attr('climate.thermostat_climate_controller', 'target_temp_low') }}"
hvac_mode: cool
mode: single
Thank you! Now I have to come up with how to reverse this to return normal mode.
alias: light min threshold AC off
trigger:
- platform: numeric_state
entity_id: sensor.lux
below: 300
condition: []
action:
- service: climate.set_hvac_mode
data:
hvac_mode: heat_cool
target:
entity_id: climate.thermostat_climate_controller
mode: single
Or should i put some condition to mitigate hysteresis? Or to check whether or not the other it’s running.
The hysteresis should be handled by the climate.thermostat i forgot…but this would work to return everything to normal state(heat_cool)?