core icon indicating copy to clipboard operation
core copied to clipboard

Fix missing devices page for utility meters created in YAML

Open dgomes opened this issue 1 year ago • 4 comments

Proposed change

Type of change

  • [ ] Dependency upgrade
  • [x] Bugfix (non-breaking change which fixes an issue)
  • [ ] New integration (thank you!)
  • [ ] New feature (which adds functionality to an existing integration)
  • [ ] Deprecation (breaking change to happen in the future)
  • [ ] Breaking change (fix/feature causing existing functionality to break)
  • [ ] Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #128163
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • [ ] The code change is tested and works locally.
  • [ ] Local tests pass. Your PR cannot be merged unless tests pass
  • [ ] There is no commented out code in this PR.
  • [ ] I have followed the development checklist
  • [ ] I have followed the perfect PR recommendations
  • [ ] The code has been formatted using Ruff (ruff format homeassistant tests)
  • [ ] Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • [ ] The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • [ ] New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

dgomes avatar Oct 11 '24 13:10 dgomes

CC @dougiteixeira

In https://github.com/home-assistant/core/pull/119761 YAML utility_meters were not handled

dgomes avatar Oct 11 '24 13:10 dgomes

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

home-assistant[bot] avatar Oct 11 '24 15:10 home-assistant[bot]

It is not working :/ I though this could be a quick fix, but by working on a test I've realised the device_id does not get set:

RegistryEntry(entity_id='select.energy', unique_id='my_unique_id', platform='utility_meter', 
previous_unique_id=None, aliases=set(), area_id=None, categories={}, capabilities=
{'options': ['peak', 'offpeak']}, config_entry_id=None, created_at=datetime.datetime(
2024, 10, 11, 22, 31, 9, 634320, tzinfo=datetime.timezone.utc), device_class=None, 
device_id=None, disabled_by=None, entity_category=None, hidden_by=None, icon=None, 
id='f2617e04bfb0caa996438d315a181cdc', has_entity_name=False, labels=set(), 
modified_at=datetime.datetime(2024, 10, 11, 22, 31, 9, 634343, tzinfo=datetime.timezone.utc), 
name=None, options={}, original_device_class=None, original_icon=None, original_name='energy', 
supported_features=0, translation_key='tariff', unit_of_measurement=None, _cache={})

dgomes avatar Oct 11 '24 22:10 dgomes

We also took some time with this with the templates only to realize in the end that it is not compatible, despite the documentation making this clear with a alert.

dougiteixeira avatar Oct 11 '24 22:10 dougiteixeira

This would take an architectural change to work for which I don't have the time at the moment.

The author of the issue has dismissed the issue, and I'm therefore closing this PR

dgomes avatar Oct 12 '24 14:10 dgomes