home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.16k stars 29.83k forks source link

Energy sensors not listed to be added to Energy dashboard #70661

Closed Benny-Git closed 2 years ago

Benny-Git commented 2 years ago

The problem

I created some new mqtt sensors I want to use on my Energy dashboard. I defined them like this:

sensor:
  - name: Heizung 1.8.1
    platform: mqtt
    state_topic: vzlogger/data/chn0/agg
    value_template: "{{ value_json.value }}"
    state_class: total_increasing
    device_class: energy
    unit_of_measurement: Wh

They don't show up in the entity list when I want to add a new entity to the Energy dashboard (/config/energy).

After reading many Discourse entries, I finally came up with a new name for the sensor, which works fine:

sensor:
  - name: Energy Heizung 1.8.1
    platform: mqtt
    state_topic: vzlogger/data/chn0/agg
    value_template: "{{ value_json.value }}"
    state_class: total_increasing
    device_class: energy
    unit_of_measurement: Wh

It looks like the Energy dashboard requires the word energy to come up in the sensor name. The device_class: energy is not enough.

I believe this is the root cause for a lot of issues with entities missing from the dashboard: #55356, #66860, #66747, #66194, #56781, #55933, #55356

What version of Home Assistant Core has the issue?

2022.4.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

energy

Link to integration documentation on our website

https://www.home-assistant.io/docs/energy/electricity-grid/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

mqtt documentation mqtt source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @emontnemery, mind taking a look at this issue as it has been labeled with an integration (mqtt) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

Benny-Git commented 2 years ago

I don't think mqtt is the one to fix this, as the issue would affect all integrations that want to expose data to the Energy dashboard. For me it showed up on the mqtt integration, but as linked above other issues come from other integrations, and might be caused by the same behavior.

emontnemery commented 2 years ago

There's no limitation in the energy dashboard where it requires the name to include "energy". The problem is more likely to be that some statistics has already been recorded for the "Heizung 1.8.1" sensor where some setting was wrong, disqualifying the sensor from energy statistics.

Do you see anything listed on the "statistics" developer tool for the "Heizung 1.8.1" sensor?

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.