core icon indicating copy to clipboard operation
core copied to clipboard

Move Home Connect alarm clock entity from time platform to number platform

Open Diegorro98 opened this issue 8 months ago • 3 comments

Breaking change

Alarm clock entity is no longer provided by the time platform, instead it will be provided by the number platform.

Proposed change

After some investigation, I realized that the controls that the time platform provides to the user doesn't fit to what the entity represents (which, at least in the known cases, is a countdown clock) as it is limited to 24h, and depending on the language or the settings, it is shown with the 12h format, also it doesn't allow to set the seconds.

That's why I'm moving it to the number platform, which provides seconds precision and allows to input values higher than 24h.

Type of change

  • [ ] Dependency upgrade
  • [ ] 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)
  • [x] 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 #
  • This PR is related to issue:
  • Link to documentation pull request: https://github.com/home-assistant/home-assistant.io/pull/38188
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • [x] The code change is tested and works locally.
  • [x] Local tests pass. Your PR cannot be merged unless tests pass
  • [x] There is no commented out code in this PR.
  • [x] I have followed the development checklist
  • [x] I have followed the perfect PR recommendations
  • [x] 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:

Diegorro98 avatar Mar 25 '25 18:03 Diegorro98

Hey there @davidmstraub, @martinhjelmare, mind taking a look at this pull request as it has been labeled with an integration (home_connect) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of home_connect can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign home_connect Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

home-assistant[bot] avatar Mar 25 '25 18:03 home-assistant[bot]

For how long does this entity exists? I notice many recent PRs are first deprecating the sensor for few months before removal, while it is more work for the developers it is more user friendly and create less frustration for users

thecode avatar Mar 25 '25 20:03 thecode

It has existed for 5 months. I added at #126155.

Diegorro98 avatar Mar 25 '25 20:03 Diegorro98

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 Mar 26 '25 08:03 home-assistant[bot]

You can look at this PR (although still WIP and there are requested changes) for an example: https://github.com/home-assistant/core/pull/141360

thecode avatar Mar 26 '25 08:03 thecode

I needed to bump the integration's minor version, as I needed to update the time alarm clock entity unique id, otherwise the time and the number alarm clock entities would have the same unique id

Diegorro98 avatar Mar 26 '25 10:03 Diegorro98

I think test are failing because the entity is now disabled by default, and I don't know how to enable it at tests. Any suggestion?

Diegorro98 avatar Mar 26 '25 10:03 Diegorro98

I think test are failing because the entity is now disabled by default, and I don't know how to enable it at tests. Any suggestion?

https://github.com/home-assistant/core/blob/74ff40e2533ae9fc91eeaf89bdfa891ee23c1693/tests/components/shelly/test_sensor.py#L466

thecode avatar Mar 26 '25 10:03 thecode

I needed to bump the integration's minor version, as I needed to update the time alarm clock entity unique id, otherwise the time and the number alarm clock entities would have the same unique id

They can have the same unique id since they belong to different platforms.

MartinHjelmare avatar Mar 26 '25 10:03 MartinHjelmare