I have floor heating and electric heater and wish to have a balanced temperature.
Basically turn on the heater, wait until a certain temperature is reached, then turned it off, when is cooled at a certain temperature turn the heater on again. ALso at night it should stay all off (regardless of temperature, only if temperature goes below a very low temperature).
I suggest using the Generic Thermostat integration and then use the Schedule integration to specify the operating schedule. Use an automation to tie the two together.
thanks, generic thermostat is of great help. But scheduler? I mean at night an automation should also check the temperatures, just in case it drops below a certain level
You would use the Scheduler to adjust the target temperature (i.e. lower at night, higher during the day). You’re not obligated to use Scheduler; you can use an automation, triggered at specific times, to adjust the target temperature.
description: ""
mode: single
trigger:
- platform: state
entity_id:
- sensor.bedroom_hygrometer_temperature
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.bedroom_hygrometer_temperature
above: 22
alias: If temperature is above 22C at any time
sequence:
- service: switch.turn_off
target:
entity_id: switch.bedroom_thermostat
alias: Turn off thermostat
- conditions:
- condition: and
conditions:
- condition: numeric_state
entity_id: ""
below: 18
alias: Temperature is below 18C
- condition: time
after: "07:00:00"
before: "22:00:00"
alias: It's day time
alias: Day time
sequence:
- service: switch.turn_on
target:
entity_id: switch.bedroom_thermostat
alias: Turn on thermostat
- conditions:
- condition: numeric_state
entity_id: sensor.bedroom_hygrometer_temperature
below: 10
alias: Turn on thermostat if temperature is below 10 regardless the time
sequence:
- service: switch.turn_on
target:
entity_id: switch.bedroom_thermostat
alias: Turn on thermostat
I’ve hard coded the time for the “warm hours”, so if you have to change this, you will have to edit the automation which requires the right privileges and the right knowledge.
When @123 talk about using a Schedule is to transfer this time management to the UI, so you can edit it in a calendar, in a much more friendly and flexible way. You definitely should think about going on that direction.
Then your code will look more like this:
description: ""
mode: single
trigger:
- platform: state
entity_id:
- sensor.bedroom_hygrometer_temperature
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.bedroom_hygrometer_temperature
above: 22
alias: If temperature is above 22C at any time
sequence:
- service: switch.turn_off
target:
entity_id: switch.bedroom_thermostat
alias: Turn off thermostat
data: {}
- conditions:
- condition: and
conditions:
- condition: numeric_state
entity_id: ""
below: 18
alias: Temperature is below 18C
- condition: state
entity_id: schedule.thermostat_warm_hours
state: "on"
alias: Day time
sequence:
- service: switch.turn_on
target:
entity_id: switch.bedroom_thermostat
alias: Turn on thermostat
data: {}
- conditions:
- condition: numeric_state
entity_id: sensor.bedroom_hygrometer_temperature
below: 10
alias: Turn on thermostat if temperature is below 10 regardless the time
sequence:
- service: switch.turn_on
target:
entity_id: switch.bedroom_thermostat
alias: Turn on thermostat
data: {}
Then you can create a schedule (Setting → Devices and Services → Helpers) with more flexible times (a different warm time for weekends, for example):
I ran across your posting to the forum page above. I wanted to apply it to a simple TP Link outlet. The issue I’m having is that at the end of the schedule the switch won’t switch off. I thought that it might be an issue with the temps keeping the switch engaged so I increased this to a point (40C) with no change. Below is the YAML (Note that temps are in Fahrenheit)
alias: Small Fan On/Off Time Temp
description: Small Fan On/Off Time and Temp
trigger:
- platform: state
entity_id:
- weather.forecast_home
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: weather.forecast_home
attribute: temperature
below: 75
alias: If temperature is below 75F at any time
sequence:
- service: switch.turn_off
target:
entity_id: switch.small_fan
alias: Turn off Small Fan
data: {}
- conditions:
- alias: Day time
condition: and
conditions:
- alias: Temperature is above 85F
condition: numeric_state
entity_id: weather.forecast_home
attribute: temperature
above: 85
- condition: state
entity_id: schedule.small_fan_schedule
state: "on"
sequence:
- service: switch.turn_on
target:
entity_id: switch.small_fan
alias: Turn on small fan
data: {}
- conditions:
- condition: numeric_state
entity_id: weather.forecast_home
attribute: temperature
above: 95
alias: Turn on small fan if temperature is above 95F regardless the time
sequence:
- service: switch.turn_on
target:
entity_id: switch.small_fan
alias: Turn on small fan
data: {}
- conditions: []
sequence: []
mode: single
The only thing triggering your automation is any change of the weather entity’s state object. If you specifically want the schedule’s state change to trigger the automation, you need to add that as a trigger too.
As @Didgeridrew mentioned, you have to work on your triggers. The triggers indicates when the conditions are evaluated and, in your case, it is only the weather “state” (which is “cloudy”, “sunny”, “rain”, etc.) changes, and not it’s temperature.
You can try something like this:
alias: Small Fan On/Off Time Temp
description: Small Fan On/Off Time and Temp
trigger:
- platform: state
entity_id:
- weather.forecast_home
attribute: temperature
- platform: state
entity_id:
- schedule.small_fan_schedule
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: weather.forecast_home
attribute: temperature
below: 75
alias: If temperature is below 75F at any time
sequence:
- service: switch.turn_off
target:
entity_id: switch.small_fan
alias: Turn off Small Fan
data: {}
- conditions:
- alias: Day time
condition: and
conditions:
- alias: Temperature is above 85F
condition: numeric_state
entity_id: weather.forecast_home
attribute: temperature
above: 85
- condition: state
entity_id: schedule.small_fan_schedule
state: "on"
sequence:
- service: switch.turn_on
target:
entity_id: switch.small_fan
alias: Turn on small fan
data: {}
- conditions:
- condition: numeric_state
entity_id: weather.forecast_home
attribute: temperature
above: 95
alias: Turn on small fan if temperature is above 95F regardless the time
sequence:
- service: switch.turn_on
target:
entity_id: switch.small_fan
alias: Turn on small fan
data: {}
- conditions: []
sequence: []
mode: single