dolezsa / thermal_comfort

Thermal Comfort sensor for HA (absolute humidity, heat index, dew point, thermal perception)
Other
610 stars 117 forks source link

Thermal Comfort won't work with the output of HA Helpers as input for temperature and humidity #390

Open thomasvnl opened 2 months ago

thomasvnl commented 2 months ago

Hi,

I have a usecase in which I combine the values from multiple sensors via a Min/Max helper set to the "mean/median" option (see: https://www.home-assistant.io/integrations/min_max/). I combine two sensors in two seperate helpers to get a more accurate outdoor temperature and humidity reading. I wanted to use Thermal Comfort to get the additional attributes like Heat Index and Absolute Humidity automatically from these more accurate "virtual" sensors/helpers.

The problem I have is that I cannot use the values of the helpers in the Thermal Comfort integration. It will not accept manual input of the entity id (which I tried as the dropdown would not show them) and only displays a long list of actual sensor inputs I can use.

Is there a way to be able to use helpers as input for Thermal Comfort at the moment or is that something that is not (yet) available?

With kind regards, Thomas

michelbalzer commented 1 month ago

@thomasvnl It lets you only choose sensors with device classes temperature or humidity: https://github.com/dolezsa/thermal_comfort/blob/bb8dda0a22b382d9c06cde2e21d976fbd7b9aa8a/custom_components/thermal_comfort/config_flow.py#L359-L364

Could you create a template sensor and add a device_class: temperature or device_class: humidity?

Quick OpenAi Example:

template:
  - sensor:
      - name: "Median Temperatur"
        unit_of_measurement: "°C"
        state: >
          {% set temp1 = states('sensor.temperatur_sensor_1') | float %}
          {% set temp2 = states('sensor.temperatur_sensor_2') | float %}
          {% set temps = [temp1, temp2] %}
          {{ temps | sort | median }}
        device_class: temperature