No devices page for utility meters created in YAML in order to get to the diagnostic sensors
The problem
The cron attribute of utility meters recently got replaced with separate sensors.
However, it seems that if one create a UM in YAML, there is no device page (not even if it has a unique ID).
I tried a number of permutations to see if there's a particular set of config fields that are problematic, but the behaviour was consistent in all cases.
One theory was that the diagnostic sensors will only exist when a tariff is defined. Another one (my theory) was that the cron field had to be used explicitly (and not implicitly via the cycle field).
See my test configs below, but I thought of hacking the URL to get to a device page, but my entities have no device ID associated, for example, this results in None:
{{ device_id('sensor.test_um_with_explicit_cron_and_tariff') }}
On my integrations page, there's also no UM integration listed. Perhaps this is related to the issue.
What version of Home Assistant Core has the issue?
core-2024.10.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Core
Integration causing the issue
Utility Meter
Link to integration documentation on our website
https://www.home-assistant.io/integrations/utility_meter/
Diagnostics information
No response
Example YAML snippet
utility_meter:
test_um_with_explicit_cycle:
unique_id: "edc33bf5-e649-4418-8728-a3a7fd8b09fc"
source: sensor.grid_energy_in
cycle: daily
test_um_with_explicit_cycle_and_offset:
unique_id: "28cf25d5-5896-458a-9a4c-aed5a0af09e3"
source: sensor.grid_energy_in
cycle: daily
offset: 30
test_um_with_explicit_cycle_and_tariff:
unique_id: "52875dac-55a5-4d9a-8b32-ac3eee0518e8"
source: sensor.grid_energy_in
cycle: daily
tariffs:
- peak
- offpeak
test_um_with_explicit_cron:
unique_id: "c5f6cd0c-269c-4b43-9534-0762618140af"
source: sensor.grid_energy_in
cron: "5 4 * * *"
test_um_with_explicit_cron_and_tariff:
unique_id: "3dbe5457-430e-4fb1-bad3-cb93c5f2380c"
source: sensor.grid_energy_in
cron: "5 4 * * *"
Anything in the logs that might be useful for us?
No response
Additional information
No response
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)
This is related to https://github.com/home-assistant/core/pull/119761
Thanks! My search didn't find that. I've subscribed to that issue.
On my integrations page, there's also no UM integration listed. Perhaps this is related to the issue.
![]()
The Utility Meter integration is classified as a helper, so it is not shown on the integrations page, only in the “Helpers” tab.
@dougiteixeira only applies to utility_meters setup using config_entry
This is related to #119761
It is not proposed to bind YAML-created utility meter entities to the source entity device, as device bindings are only supported for configuration entries.
@dougiteixeira only applies to utility_meters setup using config_entry
No, entities created via YAML also appear in the "Helpers" tab.
One way around this is to return the attributes for entities created by YAML, but exclude those attributes from the recorder.
@dougiteixeira only applies to utility_meters setup using config_entry
No, entities created via YAML also appear in the "Helpers" tab.
They appear, but since they are not bound to a device you don't get to access the diagnostic button.
On the other hand the diagnostics are simply an dump of the configuration entry, if you create UM through YAML you can read the YAML itself, so you are not loosing anything.
One way around this is to return the attributes for entities created by YAML, but exclude those attributes from the recorder.
If makes no sense, they used to be attributes but got moved to diagnostics precisely because there was no point in keeping static values (come from configuration) as attributes that would spam the recorder.
I think we might need to close this issue as not supported :(
One way around this is to return the attributes for entities created by YAML, but exclude those attributes from the recorder.
If makes no sense, they used to be attributes but got moved to diagnostics precisely because there was no point in keeping static values (come from configuration) as attributes that would spam the recorder.
That's right, the main reason they were moved to diagnostics was to avoid recording. For entities via UI it makes perfect sense, but for YAML entities it removed the feature.
The ideal would be for entities to be linked to devices via YAML, but this requires an architectural change in Home Assistant that I think is difficult to make.
So it might be feasible to return the attributes and remove them from the recorder.
Firstly, I appreciate all the feedback.
The Utility Meter integration is classified as a helper, so it is not shown on the integrations page, only in the “Helpers” tab.
That is utterly confusing, as it simply creates sensors.
if you create UM through YAML you can read the YAML itself, so you are not loosing anything.
What's lost is the ability to display such values or to access it programmatically (via templates). For now it's the cron attribute, but this could affect other really useful attributes in future when migrated.
If makes no sense, they used to be attributes but got moved to diagnostics precisely because there was no point in keeping static values (come from configuration) as attributes that would spam the recorder.
This is perhaps the strongest argument against having these as sensors – and I'd be happy with that outcome – but my point above needs to be kept in mind.
Was the blog updated? It seems the note about utility meters got removed (good, if that's the case).
Just a loose future thought (and I know this is not a feature request forum), a template function to get a config entry might be useful.