dolezsa / thermal_comfort

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

Feature: Support Weather Entity as input #231

Open rautesamtr opened 1 year ago

Torgrima commented 1 year ago

Weather sensor, as an outside temperature Weather

I am not sure if met is still the default weather sensor in home-assistant: https://www.home-assistant.io/integrations/met/

But it has all the nessesary attribute like: temperature, humidity, pressure, wind_speed. Met integration gives wether data for any location.

An additional reason for supporing external Weather data is to be able to merge with the mold sensor in home-assistant.

A sugestion if you one day will support picking attributes. Both Weather and climate have temperature as attributes.

Thanks for an incredable project, thermal comfort adds a good value to home-assistant.

bensebborn commented 1 year ago

This would be handy. Otherwise we have to buy another sensor when the data is already there.

jds11111 commented 1 year ago

Yes, that would be a natural thing to add, it is not a deal breaker, since one can create a temperature (or humidity) sensor from them with yaml. For those reading this issue and not aware, here is an example.

sensor:
  - platform: template
    met_temperature:
      friendly_name: MET temperature
      unit_of_measurement: "°F"
      value_template: >
        {% if states('weather.home')  != 'unknown' and states('weather.home')  != 'Unavailable' %}
          {%if state_attr('weather.home','temperature') %}
            {{ state_attr('weather.home','temperature') }}
          {%endif %}
        {% else %}
          {{ states('sensor.met_temperature') }}
        {%endif %}
      device_class: temperature

On the other hand, if the weather bit is added to this great integration, then forecasts of those quantities would be available.

ostracizado commented 9 months ago

Are templates working?

#Outside Temperature
  - platform: template
    sensors:
      outside_temperature:
        friendly_name: "Outside Temperature"
        unit_of_measurement: 'ºC'
        value_template: "{{ state_attr('weather.home', 'temperature') }}"

#Outside Humidity
  - platform: template
    sensors:
      outside_humidity:
        friendly_name: "Outside Humidity"
        unit_of_measurement: '%'
        value_template: "{{ state_attr('weather.home', 'humidity') }}"

Even when I get the values in development tools, they are still unknown in thermal confort.

edit:

Taking out the unit_of_measurement ('ºC', '%') solved it.

SirHamburger commented 1 week ago

The syntax may have changed. I had success with the following: Add to configuration.yaml:

template: !include template.yaml

Create template.yaml with the following:

  - sensor:
      - name: "Außentemperatur"
        unit_of_measurement: "°C"
        state: >
          {{ state_attr('weather.forecast_home', 'temperature') }}
        unique_id: 'met_outdoor_temperature'
        device_class: temperature
  - sensor:
      - name: "Außenluftfeuchtigkeit"
        unit_of_measurement: "%"
        state: >
          {{ state_attr('weather.forecast_home', 'humidity') }}
        unique_id: 'met_outdoor_humadity'
        device_class: humidity

change the names as needed and also maybe forecast_home.