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

Add power sensor to WiZ #73260

Merged
merged 5 commits into from
Jun 10, 2022
Merged

Add power sensor to WiZ #73260

merged 5 commits into from
Jun 10, 2022

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Jun 9, 2022

Proposed change

Only following modules supports power sensors:

ESP25_SOCKET_01
ESP20_SHDW_31R
ESP20_SHRGB_31R
ESP20_SHTW_31R

They don't seem to be available in the US market yet, but I was able to get an EU one and use a voltage adapter for testng.

Changelog: sbidy/pywizlight@v0.5.13...v0.5.14

wiz_power

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

@bdraco bdraco marked this pull request as ready for review June 9, 2022 06:44
@bdraco bdraco changed the title Add power monitor to WiZ Add power sensor to WiZ Jun 9, 2022
@bdraco
Copy link
Member Author

bdraco commented Jun 9, 2022

Power monitoring being false
Needs to be mocked on the test object

"""Update the WiZ device."""
try:
await bulb.updateState()
if bulb.power_monitoring is not False:
Copy link
Member

Choose a reason for hiding this comment

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

is not False? can we just do

Suggested change
if bulb.power_monitoring is not False:
if bulb.power_monitoring:

Copy link
Member Author

Choose a reason for hiding this comment

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

It could be None which means it is not initialized yet so we have to poll to get it initialized. False means its tried to do it and failed so the device doesn't support it and we shouldn't try again.

@bdraco bdraco merged commit a9ab98f into home-assistant:dev Jun 10, 2022
@bdraco bdraco deleted the wiz_power_sensor branch June 10, 2022 04:10
@bdraco
Copy link
Member Author

bdraco commented Jun 10, 2022

Thanks 👍

@github-actions github-actions bot locked and limited conversation to collaborators Jun 11, 2022
@bdraco bdraco added the noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label Jun 28, 2022
@bdraco
Copy link
Member Author

bdraco commented Jun 28, 2022

Kinda on the fence on this one though since its only limited to a few of the newer power sockets, but it was a feature request

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed has-tests integration: wiz noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants