8000 Fix upnp creating derived sensors by StevenLooman · Pull Request #57436 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix upnp creating derived sensors #57436

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

Merged

Conversation

StevenLooman
Copy link
Contributor
@StevenLooman StevenLooman commented Oct 10, 2021

Proposed change

Fix adding derived sensors (KiB/s, packets/s) on device creation.

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.
  • 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 @ehendrix23, mind taking a look at this pull request as it has been labeled with an integration (upnp) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@StevenLooman
Copy link
Contributor Author

Care for a review @ehendrix23 ?

@StevenLooman StevenLooman requested a review from ludeeus October 10, 2021 19:47
@MartinHjelmare MartinHjelmare changed the title upnp fix creating derived sensors Fix upnp creating derived sensors Oct 11, 2021
@@ -74,28 +75,32 @@

DERIVED_SENSORS: tuple[UpnpSensorEntityDescription, ...] = (
UpnpSensorEntityDescription(
key="KiB/sec_received",
key=BYTES_RECEIVED,
Copy link
Member

Choose a reason for hiding this comment

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

Side note: Having these sensors that are calculated states is not in line with our standards. Integrations that integrate devices or services should not calculate state. We have other integrations for that like template and integration sensors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you want this to be fixed with this PR @MartinHjelmare? It'll be a breaking change as certain sensors are no longer (directly) supported.

Copy link
Member
@MartinHjelmare MartinHjelmare Oct 11, 2021

Choose a reason for hiding this comment

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

No. I suggest we deprecate these sensors separately. Start by making them disabled by default. If they are still added, log a warning saying they are deprecated and will be removed in a future release. Then after some time, remove them.

Copy link
Contributor

Choose a reason for hiding this comment

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

@MartinHjelmare @StevenLooman This is bad. Us users are mostly interested in the kB/sec sensors.
Me personally I don't want to create template sensors when it can be avoided.
Is it a solution to perform the calculations in the backend library and provide the resulting data to Core? And maybe leave out / replace some of the unwanted RAW_SENSORs?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, you can offload it to the library.

Copy link
Contributor
@bouwew bouwew Oct 11, 2021

Choose a reason for hiding this comment

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

Issue requesting the proposed implementation: StevenLooman/async_upnp_client#102

@balloob
Copy link
Member
balloob commented Oct 11, 2021

Should this be part of a hot fix ?

@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label Oct 11, 2021
@StevenLooman
Copy link
Contributor Author
StevenLooman commented Oct 11, 2021

Should this be part of a hot fix ?

Sure @balloob !

@MartinHjelmare MartinHjelmare added this to the 2021.10.4 milestone Oct 11, 2021
@MartinHjelmare MartinHjelmare merged commit 3825f80 into home-assistant:dev Oct 11, 2021
@StevenLooman StevenLooman deleted the fix_57054_57228_57281_57334 branch October 11, 2021 20:08
balloob pushed a commit that referenced this pull request Oct 12, 2021
@balloob balloob mentioned this pull request Oct 12, 2021
@raidnet-ms
Copy link

Great, it is working again!

@krayj
Copy link
krayj commented Oct 13, 2021

When the calculated sensors were removed, was that breaking change documented in the update release notes for the release the change came in? I've gone back through several past releases and cannot find any release notes indicating this breaking change was included. It was only by luck I managed to find a reference to this github issue to understand what happened in the first place. After reading the comments here, it sounds like the breaking change is imminent again in the future?

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Oct 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bugfix by-code-owner cherry-picked cla-signed Hacktoberfest integration: upnp small-pr PRs with less than 30 lines. smash Indicator this PR is close to finish for merging or closing
Projects
None yet
8 participants
0