I have a Generic Thermostat using a Target Sensor for Temperature which sometimes just happens to go unavailable (the WiFi signal is weak).
Under such circumstance I would expect the Thermostat to go Off, but it doesn’t. It stays on Heat mode and remembers the last temperature reading from the (unavailable) sensor.
Is there any way I can configure HA to achieve this? (Thermostat going OFF if target sensor is not available)
temperature_xiaomi_air_1:
unit_of_measurement: '°C'
value_template: "{{ states.fan.xiaomi_air_1.attributes.temperature or 999 }}"
device_class: temperature
So if the temperature from the sensor is not available, make it very high, eg. 99 or 999 Celsius, that will cause the thermostat to go OFF.
This solution is not ideal because if messes up the sensor history, which sometimes is useful.
Another solution is to add more sensors to the area and group them into one sensor which computes the average, but this of course requires additional hardware.
Another solution yet is to write an automation that switches off the thermostat when the sensor becomes unavailable and turns it one when it is available again. I didn’t go with this solution because I have too many of them and it would translate into a lot of additional code. I just wish this logic was built in into the generic thermostat. Perhaps one day I’ll take up the task and submit a PR. Currently no time…
I was thinking about doing the same thing - return extreme high value so the thermostat will be off.
There is a rewrite of generic thermostat going right now - https://github.com/home-assistant/core/pull/31799 - and I asked for this case. Hopefully finally this use case will be supported.
I can’t imagine going on winter holidays and my whole house would heat up without any control.
If You can please leave a comment on that PR, hopefully it will be merged soon
Sadly I can’t.
I got blocked in entire Home Assistant organization on Github because of that comment. I commented before on that PR but this time someone didn’t like that I didn’t wrote anything offensive or off topic. I think this is an important issue and it is good opportunity to solve it.
It’s somewhat curious that this is still an issues here late in 2024. It seems a little more risky than, say, “oops, I left the lights on” kind of thing. It’s more the “honey, do you smell smoke?” level.
I also can’t see why the github issue was closed, other than just being stale. Anyone here follow that at the time?
The automations I’ve seen don’t cover what I’d consider are the typical use cases. Just turning off a heater when the temp sensor becomes unavailable doesn’t prevent someone from turning the climate back on. Or setting the temp set point very high where an automation might reset it again based on time of day or people home/away.
I also noticed if my automation triggers on the climate being turned (back) on, and then shutting it off if the temp sensor is unavailable still resulted in the switch being turned on. So, I delay a few seconds and force off the heater.
alias: "Climate: Bath temp sensor is or becomes unavailable."
description: |-
1) Turn off the thermostat when temp sensor becomes unavailable.
2) Prevent turning on the thermostat if the temp sensor is unavailable.
triggers:
- trigger: state
entity_id:
- climate.primary_bath
to: heat
- trigger: state
entity_id:
- sensor.primary_path_temp
to: unavailable
for:
hours: 0
minutes: 0
seconds: 10
conditions:
- condition: state
entity_id: sensor.primary_bath_temp
state: unavailable
actions:
- action: notify.mobile_app_our_phones
metadata: {}
data:
title: WARNING
message: Tried to turn on bath thermostat but temp sensor is unavailable.
- action: climate.turn_off
metadata: {}
data: {}
target:
entity_id: climate.primary_bath
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- action: switch.turn_off
metadata: {}
data: {}
target:
entity_id: switch.primary_bath_heater
mode: single