Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Plugwise to new entity naming style #75109

Merged
merged 3 commits into from
Jul 20, 2022
Merged

Conversation

frenck
Copy link
Member

@frenck frenck commented Jul 13, 2022

Proposed change

SSIA

Upgrades plugwise to 0.18.7, to aid with the device name changes.
Release: https://github.com/plugwise/python-plugwise/releases/tag/v0.18.7
Compare diff: plugwise/python-plugwise@v0.18.6...v0.18.7

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)
  • 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:

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
  • The code has been formatted using Black (black --fast 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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @CoMPaTech, @bouwew, @brefra, mind taking a look at this pull request as it has been labeled with an integration (plugwise) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@frenck frenck added smash Indicator this PR is close to finish for merging or closing and removed by-code-owner labels Jul 13, 2022
@bouwew
Copy link
Contributor

bouwew commented Jul 13, 2022

Hmm, I'm not too happy to see thesmile-part come back into the sensor, etc. names.
Also, the smile-part getting into the names will be a breaking change?

@frenck
Copy link
Member Author

frenck commented Jul 13, 2022

Hmm, I'm not too happy to see the thesmile-part come back into the sensor, etc. names.

They are not? Not in the name.
As a matter of fact, the device names are removed from the entity names completely now.

They show up in the entity ID in the new naming as the entity IDs are composed by <domain>.<device_name_sluggified>_<entity_name_sluggified>.

Also, the smile-part getting into the names will be a breaking change?

I think you mean the entity ID, no that is not a breaking change. As entities are already registered in the registry referenced by their unique IDs. Thus for existing installations they won't change.

@bouwew
Copy link
Contributor

bouwew commented Jul 13, 2022

I'm referring to changes like this:
image

If these designations do not change in existing installations, then indeed it's not a breaking change.
But when the user performs a reinstall, which sometimes is needed, for instance when adding or removing Plugwise devices, then the user will be in for a little, for some, unpleasant surprise.

@frenck
Copy link
Member Author

frenck commented Jul 13, 2022

If these designations do not change in existing installations, then indeed it's not a breaking change.

Does not change for existing installations, as it has a unique ID.

But when the user does a fresh reinstall, which sometimes is needed, for instance when adding or removing Plugwise devices, then the user will be in for a little, for some, unpleasant surprise.

So, A) that should not be needed; if it is: It's a bug that should be addressed. B) entity IDs are not guaranteed (ever) and are customizable.

We can provide the system with an object ID hint for that specific sensor. But that would take this entity out of the standardization effort Home Assistant is currently making (which IMHO will thus lead to unexpected behavior for the future).

@bouwew
Copy link
Contributor

bouwew commented Jul 13, 2022

Let's not fix this in Core, let's fix it in the backend, that's where the names are set.

Just thinking out loud: the Anna's have an Anna device, the thermostat, and a Smile Anna device, the gateway. Naming them both Anna will be too confusing. So there's no good solution for the Anna's.
For the Adams, we could rename the Smile Adam (gateway) to Adam as there are no other devices named Adam.
The same is true for the P1's and also for the Stretches I think.

So only a partial fix is possible, we can avoid the breaking changes for the devices other than the Anna.

I will spend some more time on this tonight when I'm at home.

@frenck
Copy link
Member Author

frenck commented Jul 13, 2022

So only a partial fix is possible, we can avoid the breaking changes for the devices other than the Anna.

There is no breaking change?

Let's not fix this in Core, let's fix it in the backend, that's where the names are set.

It uses the names already there present day. It removes them from being part of the entity name, as per new guidelines in the core.

https://developers.home-assistant.io/blog/2022/07/10/entity_naming

@bouwew
Copy link
Contributor

bouwew commented Jul 13, 2022

There is no breaking change?

I know, not in your book :)
Still, I don't like the fact that there will be differences between an updated Plugwise integration and a newly added Plugwise integration. So I propose we limit the differences between the two as much as possible.

How to achieve this: keep the proposed changes as they are, additionally:

  • In entity.py line 47 remove Smile from the gateway device name, change to:
    name=coordinator.data.gateway['smile_name'],
  • Link to plugwise v0.18.7 when available on Pypi (the Anna gateway will be rename to Smile, from Anna).

Can you agree to this?

@frenck
Copy link
Member Author

frenck commented Jul 13, 2022

Can you agree to this?

🤷 I'll see what it does.

Still, I don't like the fact that there will be differences between an updated Plugwise integration and a newly added Plugwise integration.

There isn't? Care to explain (or reword) what your concern about the naming change is?

So I propose we limit the differences between the two as much as possible.

I'm missing the point, but we will do changes and will make changes if that helps standardize the project or with refactoring. Nothing in this change is breaking and this change is rolled out to all integrations.

@bouwew
Copy link
Contributor

bouwew commented Jul 13, 2022

@frenck
Copy link
Member Author

frenck commented Jul 13, 2022

It's not available on PyPi?

@CoMPaTech
Copy link
Contributor

CoMPaTech commented Jul 13, 2022

It's not available on PyPi?

(...).7a0 was :) - PR merge pending on that small one

@bouwew
Copy link
Contributor

bouwew commented Jul 14, 2022

Sorry, it's there now.

@frenck
Copy link
Member Author

frenck commented Jul 14, 2022

Looking good, thanks @bouwew & @CoMPaTech 👍

Copy link
Contributor

@bouwew bouwew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to the test-files can be reverted after adding the last commit.

@frenck frenck force-pushed the frenck-2022-1427 branch from f42a73d to 2a90daa Compare July 14, 2022 09:51
@MartinHjelmare MartinHjelmare merged commit 93425b0 into dev Jul 20, 2022
@MartinHjelmare MartinHjelmare deleted the frenck-2022-1427 branch July 20, 2022 09:38
@github-actions github-actions bot locked and limited conversation to collaborators Jul 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed has-tests integration: plugwise new-feature smash Indicator this PR is close to finish for merging or closing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants