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
822 stars 126 forks source link

device_class=temperature filtering prevents selecting helpers for external temperature/humidity sensors #1163

Open PabloCamp0s opened 11 months ago

PabloCamp0s commented 11 months ago

Prerequisites

Description

This commit added a filter for external sensors using device_class. Although makes perfect sense, filtering by device_class actually breaks selecting a helper sensor instead of a temperature/humidity one. In my specific case, I group several sensors in the same room and use a min/max sensor configured with mean calculation for the final room temperature. With this commit, I cannot create new thermostats.

As a workaround, I've added to the helper the "device_class: temperature" and "device_class: humidity" with the developer tools just before provisioning the new thermostat, but this assignment doesn't last. Unfortunately, Home Assistant does not allow to define a device_class attribute for helpers.

Steps to Reproduce

  1. Create a helper with min/max integration grouping temperature or humidity sensors.
  2. Add a new thermostat and use the external temperature sensor selector.

Expected behavior:

The helper should be as an option in the selector.

Actual behavior:

The helper does not appear.

Versions

HA: Core 2023.11.3, Frontend 20231030.2 BT: 1.4.0

Additional Information

Until Home Assistant provides a definition for device_class attribute when creating a helper, the quick fix should be removing the device_class filter. As an alternative, perhaps adding a checkbox alongside the selector in order to enable/disable the filter by the user.

I don't have the knowledge for creating the checkbox and manage it accordingly and creating a pull request removing the filter with no previous discussion doesn't sound good either. Therefore, the issue seemed to be the best approach.

Thanks in advance.

PabloCamp0s commented 11 months ago

Workaround

I've found that Home Assistant supports entity customization via yaml. Therefore, it's possible to add a device_class to any helper using this feature.

The issue has indeed low priority.

hkjdsadhj commented 3 weeks ago

I'd like to elaborate whats to do, for beginners like me:

https://community.home-assistant.io/t/helper-combine-two-values-cannot-be-selected-as-temperature-entity-in-integrations-why/782035/6