Hello, I have these two automations to switch on my heating system in a second residence to avoid water pipes to freeze with a sonoff TH16 thermostat and a sonoff switch:
- id: '1611511929627'
alias: Avoid freezing on
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.thermostat
below: '5'
condition: []
action:
- service: switch.turn_on
data: {}
entity_id: switch.sonoff_1000a0eba5
mode: single
- id: '1611511341689'
alias: Avoid freezing off
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.thermostat
attribute: unit_of_measurement
above: '7'
condition: []
action:
- service: switch.turn_off
data: {}
entity_id: switch.sonoff_1000a0eba5
mode: single
The problem with this is if I want to warm the house to live in, with the second automation activated, the heating switch is set off when the temperature is above 7 degrees, and of course that’s not the desired behaviour. I want to remain on until maybe 22 degress.
Does anybody know how could I automate this behaviour without deactivating the ‘Avoid freezing off’?
TIA
Miguel
I forgot to say that, when I want to get the house warm, I manually switch-on the switch. So, what I’d like is that when I switch It manually on, the automation does not work until I manually switch the heating off again.
Rather than have the ‘off’ automation trigger at a temperature, have it as part of the automation that triggered because it dropped below 5…
- id: '1611511929627'
alias: Avoid freezing
trigger:
platform: numeric_state
entity_id: sensor.thermostat
below: 5
action:
- service: switch.turn_on
entity_id: switch.sonoff_1000a0eba5
- wait_template: "{{ states('sensor.thermostat')|int > 7 }}"
timeout:
hours: 2
continue_on_timeout: true
- service: switch.turn_off
entity_id: switch.sonoff_1000a0eba5
1 Like
Thank you for the reply
I have a doubt. What is the efect of the timeout? I mean, what happens if in the 2 hours span the temperature is still not above 7 degrees? I suppose the heating will set off after this time in any case.
And what would be the effect if no timeut is set in the automation?
1 Like
Yeah, it will timeout at 2 hours and switch off, it’s just a failsafe really in case there’s some kind of fault with the system. I set it at 2 hours on the basis that I guessed it would take no more than about an hour and a half, and then lobbed another half hour to be sure. So long as the temperature has gone over 5 again the automation will trigger again when it drops below again, and of course if it doesn’t get from 4.9 to 5.1 in 2 hours then there’s no point in it triggering again because it’s broken. But if you think that’s too short (because from prior knowledge it takes a long time to get to 7.5) then obviously change it to 3 or whatever.
1 Like