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

Handle Shelly channel names (if available) #40119

Merged
merged 17 commits into from
Sep 27, 2020
Merged

Handle Shelly channel names (if available) #40119

merged 17 commits into from
Sep 27, 2020

Conversation

chemelli74
Copy link
Contributor

@chemelli74 chemelli74 commented Sep 15, 2020

Proposed change

Current code handle only device name; this PR handle also channels name when they are available.

Integration doc page should be updated to inform how naming works and how to update device/channel name for end user.

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)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

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.
  • 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 @balloob, @bieniu, mind taking a look at this pull request as its been labeled with an integration (shelly) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@chemelli74
Copy link
Contributor Author

Only missing the calculation of channel number for switch ( hardcoded 1 for the moment)

Simone

@MartinHjelmare MartinHjelmare changed the title Shelly: handle channel names (if available) Handle Shelly channel names (if available) Sep 16, 2020
@chemelli74 chemelli74 marked this pull request as ready for review September 18, 2020 10:48
@bieniu
Copy link
Member

bieniu commented Sep 18, 2020

IMO we still have an inconsistency here. If the device has one channel, we don't use the channel name, and if the device has more than one channel, we use the channel names.

@chemelli74
Copy link
Contributor Author

IMO we still have an inconsistency here. If the device has one channel, we don't use the channel name, and if the device has more than one channel, we use the channel names.

Partially true:

  • Shelly app "sync name" function use the name you gave to the channel and save it under "device" in the settings page of the device.
  • Most likely channel name value for single channel devices will be removed by upcoming fw patches.

BTW, we still miss channel name for 3EM/EM; it's missing for firmware so before adding the node "emeters/name" I want to wait and see exactly how it will be implemented.

@bieniu
Copy link
Member

bieniu commented Sep 18, 2020

So maybe we should wait with the channel names until the situation clears up. IMO channel names should be used in all cases or not at all.

@chemelli74
Copy link
Contributor Author

chemelli74 commented Sep 18, 2020

So maybe we should wait with the channel names until the situation clears up. IMO channel names should be used in all cases or not at all.

I perfectly understand the idea to have a unique naming policy, but we should also take care of how the device works.
I would prefer to be as closed as possible to current Shelly app naming schema to make life easy for users.

So channel name -> device name -> hostname is the best name preference we can up with.

Simone

@bieniu
Copy link
Member

bieniu commented Sep 18, 2020

I would prefer to be as closed as possible to current Shelly app naming schema to make life easy for users.

But we're not making copy of the Shelly app. I think that the opinion of someone from the HA Team is needed here.

@chemelli74
Copy link
Contributor Author

I would prefer to be as closed as possible to current Shelly app naming schema to make life easy for users.

But we're not making copy of the Shelly app.

:-)

I think that the opinion of someone from the HA Team is needed here.

Agree

Simone

Copy link
Member

@thecode thecode left a comment

Choose a reason for hiding this comment

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

I suggest to remove "-" only between channel and name for sensors we leave the "-"

homeassistant/components/shelly/entity.py Outdated Show resolved Hide resolved
@chemelli74
Copy link
Contributor Author

3 green lights, time to merge ;-)

Simone

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

The branch used isn't clean. It contains 44 commits, of which the larger part is unrelated. Please start with a fresh branch based on the upstream dev when creating a new feature. In this case, a git rebase can clean it up.

For information on how to handle upstream changes and keeping your fork up 2 date: https://developers.home-assistant.io/docs/development_catching_up

Integration doc page should be updated to inform how naming works and how to update device/channel name for end user.

Your PR description points out the need to adjust the documentation, however, I don't see a documentation PR linked up?

@chemelli74
Copy link
Contributor Author

The branch used isn't clean. It contains 44 commits, of which the larger part is unrelated. Please start with a fresh branch based on the upstream dev when creating a new feature. In this case, a git rebase can clean it up.

For information on how to handle upstream changes and keeping your fork up 2 date: https://developers.home-assistant.io/docs/development_catching_up

Done.
Thx a lot for pointing this out.

Integration doc page should be updated to inform how naming works and how to update device/channel name for end user.

Your PR description points out the need to adjust the documentation, however, I don't see a documentation PR linked up?

We will provide info on how to name device in the doc, but nothing mandatory imho.
Currently Shelly users using their mobile app has things already in place.
Those not using, already found their way.

Simone

homeassistant/components/shelly/entity.py Outdated Show resolved Hide resolved
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
thecode added a commit to thecode/home-assistant.io that referenced this pull request Sep 25, 2020
Update Shelly entities naming as implemented in PR:
home-assistant/core#40119
@chemelli74
Copy link
Contributor Author

Doc PR linked, we should be on track for a merge now.

Simone

thecode added a commit to thecode/home-assistant.io that referenced this pull request Sep 25, 2020
Update Shelly entities naming as implemented in PR:
home-assistant/core#40119
thecode added a commit to thecode/home-assistant.io that referenced this pull request Sep 25, 2020
Update Shelly entities naming as implemented in PR:
home-assistant/core#40119
thecode added a commit to thecode/home-assistant.io that referenced this pull request Sep 25, 2020
Update Shelly entities naming as implemented in PR:
home-assistant/core#40119
@balloob balloob merged commit 8895752 into home-assistant:dev Sep 27, 2020
@@ -20,6 +20,33 @@ def temperature_unit(block_info: dict) -> str:
return TEMP_CELSIUS


def shelly_naming(self, block, entity_type: str):
Copy link
Member

Choose a reason for hiding this comment

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

It's standard to use a verb in imperative as first word in function names. I'd rename this to name_shelly.

@chemelli74 chemelli74 deleted the chemelli74-naming branch September 27, 2020 10:40
Bre77 pushed a commit to Bre77/core that referenced this pull request Sep 30, 2020
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Bre77 pushed a commit to Bre77/core that referenced this pull request Oct 1, 2020
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants