jheling / freeathome

Free@Home component for Home Assistant
103 stars 37 forks source link

Climate devices don't provide long-term statistics #143

Closed guerda closed 1 year ago

guerda commented 1 year ago

I'm a huge fan of this extension and it's so easy to use free@home with home assistant, thanks to you.

I setup all devices, including some thermostats (Raumtemperaturregler and ABB-free@homeTouch 4.3"). I'm able to read out the current temperature, but not as a long-term statistic, which is needed for gauges and other plots. Would it be possible to offer this?

Home Assistant told me to link you to this page: https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics :)

Thanks in advance!

s-b-n commented 1 year ago

You can take the current temperature as an input for a sensor template.

You add it to your config.yaml as follows:

template:
  - sensor:
      - name: "Temperatur Wohnzimmer"
        unit_of_measurement: "°C"
        state_class: measurement
        state: "{{ '%.1f'|format(state_attr('climate.rtr_whz', 'current_temperature')) }}"

As you can see in line 5 you can specify the state_class, so that the sensor shows up in the long-term statistics.

guerda commented 1 year ago

Thank you, I appreciate your fast help. I will try it out!