jazzaj / home-assistant-homematic

Integrating homematic devices into Home-Assistant using pyhomematic
2 stars 2 forks source link

energy consumption not working in Home Assistant energy monitoring #12

Open philipp089 opened 2 years ago

philipp089 commented 2 years ago

Hi guys,

i wanted to add my Homematic IP Devices to the Home Assistant Energy Monitoring but they are not visible there, i even tried to make a sensor via config-file:

- platform: template sensors: wandschalter_schlafzimmer_verbrauch: friendly_name: "Wandschalter Schlafzimmer Verbrauch" unit_of_measurement: "kWh" value_template: "{{ state_attr('switch.00085a49a49f84', 'today_energy_kwh') }}"

but that one did not work either.

As suggested in the HA-Docu:

image

i will link the following:

https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics

Would it be possible to add the kWh-consumption in a way that HA can make use of it in the Energy Monitoring window?

Cheers, Philipp

danielperna84 commented 2 years ago

This is an old project that is not relevant to the Home Assistant integration anymore. That being said, your request has already been raised in the Home Assistant repository and the community. It will be added once someone steps in to do the implementation. For long term statistics there is already this pull request. Not sure if this will also cover your request.

philipp089 commented 2 years ago

I solved it with a template in config.yaml for now, but would be nice if i would not have to do it that way. The device_class and state_class is missing for Homematic Devices.

  #
  # WANDSCHALTER WERKSTATT kWh
  #
template:
  - sensor:
    - name: "Wandschalter Werkstatt Verbrauch"
      unit_of_measurement: "kWh"
      device_class: "energy"
      state_class: "total_increasing"
      state: "{{ state_attr('switch.00085a49a49be1', 'today_energy_kwh') }}"

Cheers, Philipp