Utility Meter device class missing
The problem
When you create a new Utility Meter it ALWAYS has the device class missing. There is no easy way to add this post event. Although people have supplied links to customizing the Helper these do not work, and you cannot simply add this. I have seen this issue reported many times and closed without any fix to the base. For a newbie like me this is a nightmare. I have use the State view and done a set to try and add this and sometimes that works and sometimes it doesn't.
Infact Im sure this example Im submitting will not work at all with just that brief YAML. It seems its doesn't inherit from the underlying devices
This means I cannot add it to for example the Energy Dashboard
What version of Home Assistant Core has the issue?
System Information version | core-2024.10.1 -- | -- installation_type | Home Assistant OS dev | false hassio | true docker | true user | root virtualenv | false python_version | 3.12.4 os_name | Linux os_version | 6.6.31-haos-raspi arch | aarch64 timezone | Europe/London config_dir | /config Home Assistant Community Store
GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok HACS Data | ok GitHub API Calls Remaining | 5000 Installed Version | 2.0.1 Stage | running Available Repositories | 1429 Downloaded Repositories | 5 Home Assistant Cloud
logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok Home Assistant Supervisor
host_os | Home Assistant OS 13.1 -- | -- update_channel | stable supervisor_version | supervisor-2024.09.1 agent_version | 1.6.0 docker_version | 26.1.4 disk_total | 116.8 GB disk_used | 16.7 GB healthy | true supported | true host_connectivity | true supervisor_connectivity | true ntp_synchronized | true virtualization | board | rpi5-64 supervisor_api | ok version_api | ok installed_addons | Mosquitto broker (6.4.1), Studio Code Server (5.17.1), Get HACS (1.3.1), Frigate (Full Access) (0.14.1), Advanced SSH & Web Terminal (19.0.0), File editor (5.8.0), Terminal & SSH (9.15.0), GivTCP-BETA (3.0.4) Dashboards
dashboards | 7 -- | -- resources | 2 views | 5 mode | storage Recorder
oldest_recorder_run | 29 September 2024 at 20:58 -- | -- current_recorder_run | 5 October 2024 at 16:14 estimated_db_size | 260.27 MiB database_engine | sqlite database_version | 3.45.3
Home Assistant Community Store
GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok HACS Data | ok GitHub API Calls Remaining | 5000 Installed Version | 2.0.1 Stage | running Available Repositories | 1429 Downloaded Repositories | 5Home Assistant Cloud
logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | okHome Assistant Supervisor
host_os | Home Assistant OS 13.1 -- | -- update_channel | stable supervisor_version | supervisor-2024.09.1 agent_version | 1.6.0 docker_version | 26.1.4 disk_total | 116.8 GB disk_used | 16.7 GB healthy | true supported | true host_connectivity | true supervisor_connectivity | true ntp_synchronized | true virtualization | board | rpi5-64 supervisor_api | ok version_api | ok installed_addons | Mosquitto broker (6.4.1), Studio Code Server (5.17.1), Get HACS (1.3.1), Frigate (Full Access) (0.14.1), Advanced SSH & Web Terminal (19.0.0), File editor (5.8.0), Terminal & SSH (9.15.0), GivTCP-BETA (3.0.4)Dashboards
dashboards | 7 -- | -- resources | 2 views | 5 mode | storageRecorder
oldest_recorder_run | 29 September 2024 at 20:58 -- | -- current_recorder_run | 5 October 2024 at 16:14 estimated_db_size | 260.27 MiB database_engine | sqlite database_version | 3.45.3What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Utility Meter
Link to integration documentation on our website
https://www.home-assistant.io/integrations/utility_meter/
Diagnostics information
System Information
| version | core-2024.10.1 |
|---|---|
| installation_type | Home Assistant OS |
| dev | false |
| hassio | true |
| docker | true |
| user | root |
| virtualenv | false |
| python_version | 3.12.4 |
| os_name | Linux |
| os_version | 6.6.31-haos-raspi |
| arch | aarch64 |
| timezone | Europe/London |
| config_dir | /config |
Home Assistant Community Store
| GitHub API | ok |
|---|---|
| GitHub Content | ok |
| GitHub Web | ok |
| HACS Data | ok |
| GitHub API Calls Remaining | 5000 |
| Installed Version | 2.0.1 |
| Stage | running |
| Available Repositories | 1429 |
| Downloaded Repositories | 5 |
Home Assistant Cloud
| logged_in | false |
|---|---|
| can_reach_cert_server | ok |
| can_reach_cloud_auth | ok |
| can_reach_cloud | ok |
Home Assistant Supervisor
| host_os | Home Assistant OS 13.1 |
|---|---|
| update_channel | stable |
| supervisor_version | supervisor-2024.09.1 |
| agent_version | 1.6.0 |
| docker_version | 26.1.4 |
| disk_total | 116.8 GB |
| disk_used | 16.7 GB |
| healthy | true |
| supported | true |
| host_connectivity | true |
| supervisor_connectivity | true |
| ntp_synchronized | true |
| virtualization | |
| board | rpi5-64 |
| supervisor_api | ok |
| version_api | ok |
| installed_addons | Mosquitto broker (6.4.1), Studio Code Server (5.17.1), Get HACS (1.3.1), Frigate (Full Access) (0.14.1), Advanced SSH & Web Terminal (19.0.0), File editor (5.8.0), Terminal & SSH (9.15.0), GivTCP-BETA (3.0.4) |
Dashboards
| dashboards | 7 |
|---|---|
| resources | 2 |
| views | 5 |
| mode | storage |
Recorder
| oldest_recorder_run | 29 September 2024 at 20:58 |
|---|---|
| current_recorder_run | 5 October 2024 at 16:14 |
| estimated_db_size | 260.27 MiB |
| database_engine | sqlite |
| database_version | 3.45.3 |
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
After some more digging this is the actual YAML produced for the final Utility Meter state_class: total_increasing status: paused last_period: "0" last_valid_state: None tariff: offpeak last_reset: "2024-10-07T11:48:39.394395+00:00" next_reset: "2024-10-08T00:00:00+01:00" unit_of_measurement: kWh friendly_name: Grid Import offpeak
I have now added the line through State and setting . I then have to reboot HA for it to be implemented and I now have
state_class: total_increasing status: paused last_period: "0" last_valid_state: None tariff: offpeak last_reset: "2024-10-07T11:48:39.394395+00:00" next_reset: "2024-10-08T00:00:00+01:00" unit_of_measurement: kWh device_class: energy friendly_name: Grid Import offpeak
With device_class as it should be
Hey there @dgomes, mind taking a look at this issue as it has been labeled with an integration (utility_meter) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of utility_meter can trigger bot actions by commenting:
-
@home-assistant closeCloses the issue. -
@home-assistant rename Awesome new titleRenames the issue. -
@home-assistant reopenReopen the issue. -
@home-assistant unassign utility_meterRemoves the current integration label and assignees on the issue, add the integration domain after the command. -
@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the issue. -
@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
utility_meter documentation utility_meter source (message by IssueLinks)
can you share the state of your source_sensor ?
I presume this is what you mean [image: image.png] Kind regards
Pete Rawlings
On Mon, 7 Oct 2024 at 14:29, Diogo Gomes @.***> wrote:
can you share the state of your source_sensor ?
— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/127809#issuecomment-2396939859, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEGGW2BDJSAFZ42AKWB4FWTZ2KED5AVCNFSM6AAAAABPPZG6KKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJWHEZTSOBVHE . You are receiving this because you authored the thread.Message ID: @.***>
As that didnt work from email heres a video showing the state you asked for followed by me creating the Utility Meter and it failing to add the device_class . Hope this is more helpful
https://github.com/user-attachments/assets/8de29707-cf84-4453-b7dd-9a5778bb2f61
You source does not have a device class....
The issue is in your source device
I do not understand Im looking at the screen at the start of the video which is the Source Device and it clearly shows device_class: energy and copy and pasting from the source device it says
state_class: total unit_of_measurement: kWh device_class: energy friendly_name: GivTCP Energy Battery Discharge Energy Today kWh
Sorry, very difficult to see your video (would be best to have screenshot or textual copies)
But from this part at the end of the video I seen that the source has yet to communicate any new state to the utility meter, so there is no chance for the utility_meter to know the device_class
So are you saying ONCE new data is received in the source and sent to this new meter THEN the device_class will be set? I dont understand why you do not inherit it immediately from the Source this would at least make it available to be added to things like the Energy Dashboard. You cannot do this while it does not have a device_class.
Update: I checked after I knew the Utility Meter Helper sensor should have data and it now has the device_class. Can you please document this as a warning or inherit on creation . I've spent(wasted) days trying to figure out why I could not add to the Energy Dashboard.
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.