KartoffelToby / better_thermostat

This custom component for Home Assistant will add crucial features to your climate-controlling TRV (Thermostatic Radiator Valves) to save you the work of creating automations to make it smart. It combines a room-temperature sensor, window/door sensors, weather forecasts, or an ambient temperature probe to decide when it should call for heat and automatically calibrate your TRVs to fix the imprecise measurements taken in the radiator's vicinity.
https://better-thermostat.org
GNU Affero General Public License v3.0
832 stars 126 forks source link

Better Thermostat Unavailability with Window Sensors #1333

Open viprapp opened 7 months ago

viprapp commented 7 months ago

Issue Report: Better Thermostat Unavailability with Window Sensors

📝 Description

Problem Overview: When a window sensor connected to the Better Thermostat is marked as offline or unavailable, the entire thermostat system becomes non-operational. This presents a significant issue since window sensors, typically powered by batteries, may occasionally lose connectivity.

Why It Matters:

🔄 Steps to Reproduce

To encounter this issue, follow these steps:

  1. Integration Setup: Add a new thermostat via the Better Thermostat integration in Home Assistant.
  2. Sensor Configuration: Configure the thermostat to utilize a window sensor.
  3. Sensor Status: Observe the behavior when the window sensor goes offline.

Expected Behavior

🟢 Operational Thermostat: Despite the window sensor's status, the thermostat should remain functional and fully available within Home Assistant.

Actual Behavior

🔴 Total Unavailability: The thermostat, along with all its entities, becomes unavailable when the connected window sensor goes offline.

📊 Versions


For further assistance or to report similar issues, please reach out to the Better Thermostat support team or consult the Home Assistant Community. 🛠️

viprapp commented 6 months ago

Workaround

For anyone else that has this problem.

{% set entities = [states('binary_sensor.sensor1'), states('binary_sensor.sensor2')] %}
{% if entities | select('equalto', 'off') | list | count == entities | count %}
  off
{% else %}
  on
{% endif %}

This will set the contact sensor state to "open" if any of the sensors are open or unavailable. Per design this will also combine multiple sensors to one. Simply remove one sensor from the set to get the functionality for one sensor only.