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 Shelly motion sensor switch #115312

Merged

Conversation

chemelli74
Copy link
Contributor

Breaking change

Proposed change

Add a switch for Shelly Motion devices to enable/disable motion detection

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
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format 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.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented Apr 9, 2024

Hey there @balloob, @bieniu, @thecode, @bdraco, mind taking a look at this pull request as it has been labeled with an integration (shelly) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of shelly can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign shelly Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@chemelli74
Copy link
Contributor Author

Thx @thecode for making the switch a RestoreEntity !

@chemelli74 chemelli74 marked this pull request as ready for review April 19, 2024 18:41
@chemelli74
Copy link
Contributor Author

Add tests from @thecode, thx !

Copy link
Member

@bieniu bieniu left a comment

Choose a reason for hiding this comment

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

The code looks ok and works with real device (Motion 2), I suggest a small change and a rebase is required.

homeassistant/components/shelly/switch.py Outdated Show resolved Hide resolved
homeassistant/components/shelly/switch.py Outdated Show resolved Hide resolved
@chemelli74 chemelli74 force-pushed the chemelli74-shelly-motion-switch branch from f621a7b to 97c8105 Compare May 8, 2024 08:33
@chemelli74 chemelli74 requested a review from bieniu May 8, 2024 08:33
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.

Added suggestions to fix the tests

tests/components/shelly/test_switch.py Outdated Show resolved Hide resolved
tests/components/shelly/test_switch.py Show resolved Hide resolved
tests/components/shelly/test_switch.py Outdated Show resolved Hide resolved
chemelli74 and others added 2 commits May 13, 2024 21:06
Co-authored-by: Shay Levy <levyshay1@gmail.com>
Co-authored-by: Shay Levy <levyshay1@gmail.com>
Co-authored-by: Shay Levy <levyshay1@gmail.com>
Co-authored-by: Shay Levy <levyshay1@gmail.com>
chemelli74 and others added 4 commits May 16, 2024 09:55
Co-authored-by: Shay Levy <levyshay1@gmail.com>
Co-authored-by: Shay Levy <levyshay1@gmail.com>
Co-authored-by: Shay Levy <levyshay1@gmail.com>
@chemelli74 chemelli74 requested a review from bieniu May 16, 2024 08:05
Copy link
Member

@bieniu bieniu left a comment

Choose a reason for hiding this comment

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

Looks good, tested with Motion 2. Thanks @chemelli74 @thecode

@chemelli74 chemelli74 merged commit 32a9cb4 into home-assistant:dev May 16, 2024
23 of 24 checks passed
@chemelli74 chemelli74 deleted the chemelli74-shelly-motion-switch branch May 16, 2024 10:49
aschmere pushed a commit to aschmere/hacore2 that referenced this pull request May 16, 2024
* Add Shelly motion sensor switch

* update name

* make motion switch a restore entity

* add test

* apply review comment

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* rename switch

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* fix ruff

---------

Co-authored-by: Shay Levy <levyshay1@gmail.com>
tr4nt0r pushed a commit to tr4nt0r/ha-core that referenced this pull request May 17, 2024
* Add Shelly motion sensor switch

* update name

* make motion switch a restore entity

* add test

* apply review comment

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* rename switch

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* Update tests/components/shelly/test_switch.py

Co-authored-by: Shay Levy <levyshay1@gmail.com>

* fix ruff

---------

Co-authored-by: Shay Levy <levyshay1@gmail.com>
@github-actions github-actions bot locked and limited conversation to collaborators May 17, 2024
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.

None yet

5 participants