Skip to content

Round electric current value of Fritz!DECT smart plugs#73865

Closed
mib1185 wants to merge 1 commit into
home-assistant:devfrom
mib1185:fritzbox/round-electric-current-value
Closed

Round electric current value of Fritz!DECT smart plugs#73865
mib1185 wants to merge 1 commit into
home-assistant:devfrom
mib1185:fritzbox/round-electric-current-value

Conversation

@mib1185
Copy link
Copy Markdown
Member

@mib1185 mib1185 commented Jun 22, 2022

Proposed change

Based on #73224 (comment) and #73224 (comment) this will round the value of the electric current sensor to a precision of 4 digits

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

  • 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
Copy Markdown

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

@mib1185 mib1185 changed the title Round electric current value for Fritz!DECt smart plugs Round electric current value for Fritz!DECT smart plugs Jun 22, 2022
@mib1185 mib1185 changed the title Round electric current value for Fritz!DECT smart plugs Round electric current value of Fritz!DECT smart plugs Jun 22, 2022
state_class=SensorStateClass.MEASUREMENT,
suitable=lambda device: device.has_powermeter, # type: ignore[no-any-return]
native_value=lambda device: device.power / device.voltage / 1000
native_value=lambda device: round(device.power / device.voltage / 1000, 4)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually, this is a "virtual" entity, as it is not a native value provided by the device or service (but calculated in HA). That is not allowed. This sensor should be removed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It would be very helpful to see current in ampere out of the box from this device to improve user experience, because most other devices provide the same.
I don't see any convenient way to calculate current in HA. Is there an easy way by GUI to create a current entity by doing calculation including rounding? A rule would run into errors, if the device is renamed.
So why not provide calculated current out of the box?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this discussion should be continued in #78324 (comment)

@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@github-actions github-actions Bot added the stale label Jul 23, 2022
@mib1185
Copy link
Copy Markdown
Member Author

mib1185 commented Jul 23, 2022

not stale

@github-actions github-actions Bot removed the stale label Jul 23, 2022
@mib1185
Copy link
Copy Markdown
Member Author

mib1185 commented Sep 12, 2022

still not stale

@mib1185
Copy link
Copy Markdown
Member Author

mib1185 commented Sep 12, 2022

this PR is superseded by #78324

@mib1185 mib1185 closed this Sep 12, 2022
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 13, 2022
@mib1185 mib1185 deleted the fritzbox/round-electric-current-value branch July 31, 2024 17:56
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.

4 participants