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 Sleepiq services #30722

Closed
wants to merge 4 commits into from
Closed

Conversation

Jay2645
Copy link
Contributor

@Jay2645 Jay2645 commented Jan 13, 2020

Description:

Added services "set_sleep_number" and "set_to_favorite_sleep_number" to the SleepIQ component. This allows for changing the sleep number of a Sleep Number bed via automations.

No other changes have been made.

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#11735

Checklist:

  • [ x ] The code change is tested and works locally.
  • [ x ] Local tests pass with tox. Your PR cannot be merged unless tests pass
  • [ x ] There is no commented out code in this PR.
  • [ x ] I have followed the development checklist

If the code communicates with devices, web services, or third-party tools:

  • [ x ] The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • [ x ] New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • [ x ] Untested files have been added to .coveragerc.

@homeassistant

This comment has been minimized.

Added services "set_sleep_number" and "set_to_favorite_sleep_number" to the SleepIQ component. This allows for automation of Sleep Number bed controls.
@frenck
Copy link
Member

frenck commented Jan 13, 2020

Thank you for your contribution thus far! 🎖 Since this is a significant contribution, we would appreciate you'd added yourself to the list of code owners for this integration. ❤️

Please, add your GitHub username to the manifest.json of this integration.

For more information about "code owners", see: Architecture Decision Record 0008: Code owners.

⚠️ I was unable to find a documentation PR (matching this code change) in our documentation repository.

Please, update the documentation and open a PR for it (be sure to create a documentation PR against the next branch) and link 🔗 this PR and the new documentation PR by mentioning the link to the PR's in both openings posts/descriptions.

🏷 I am adding the docs-missing label until this has been resolved.

@Jay2645
Copy link
Contributor Author

Jay2645 commented Jan 14, 2020

@frenck Documentation added -- PR home-assistant/home-assistant.io#11735.

@Jay2645
Copy link
Contributor Author

Jay2645 commented Jan 22, 2020

Pinging @frenck or @fabaff -- any status updates? :)

@robert-alfaro
Copy link

I've been meaning to add these changes for a long while now.. good thing I looked at open PRs! Thanks @Jay2645

bump

@bdraco
Copy link
Member

bdraco commented Mar 18, 2020

@technicalpickles It looks like you did the original PR. #2949 Can you take a look at this?

@technicalpickles
Copy link
Contributor

@bdraco I don't think I'll have any helpful feedback, as it's been quite awhile since I've done any HA development, and I'm not using the sleepiq component 😓 Let me know if you want/need commit/release access to the sleepyq library.

@bdraco
Copy link
Member

bdraco commented Mar 18, 2020

@bdraco I don't think I'll have any helpful feedback, as it's been quite awhile since I've done any HA development, and I'm not using the sleepiq component 😓 Let me know if you want/need commit/release access to the sleepyq library.

@technicalpickles Thanks for getting back to us on this! I think it would be best to add @Jay2645 and @robert-alfaro to the repo as I'm just doing the code review here.

@bdraco bdraco self-requested a review March 30, 2020 05:52
@bdraco
Copy link
Member

bdraco commented Mar 31, 2020

@Jay2645 How about using entity service on the SleepNumberSensor sensor? https://developers.home-assistant.io/docs/dev_101_services/#entity-services

This would make the change much smaller.

@bdraco bdraco removed their request for review April 2, 2020 21:53

DATA.set_to_favorite_sleep_number(bed, side)

hass.services.register(DOMAIN, SERVICE_SET_SLEEP_NUMBER, handle_set_number)
Copy link
Member

Choose a reason for hiding this comment

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

Please create service voluptuous schemas that validates the service data and pass the schema when registering the service. See other integrations for examples.

if 0 < sleep_number <= 100:
self._set_sleep_number(bed_name, side, int(sleep_number))
else:
message = f"Invalid sleep number: {sleep_number}"
Copy link
Member

Choose a reason for hiding this comment

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

Please don't format the message before passing it to the logger. Use old style string formatting in combination with the logger to avoid not needed formatting if the logging isn't activated.

homeassistant/components/sleepiq/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/sleepiq/__init__.py Outdated Show resolved Hide resolved
Dev automation moved this from Needs review to Review in progress Apr 15, 2020
@MartinHjelmare MartinHjelmare self-assigned this Apr 19, 2020
@stale
Copy link

stale bot commented May 19, 2020

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.

@stale stale bot added the stale label May 19, 2020
Changes `if len(side) == 0` to `if not side`

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
@stale stale bot removed the stale label May 24, 2020
Change `if len(bed_name) == 0` to `if not bed_name`

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
@stale
Copy link

stale bot commented Jun 23, 2020

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.

@stale stale bot added the stale label Jun 23, 2020
@frenck
Copy link
Member

frenck commented Jun 23, 2020

The last response from author is from January, closing this PR as stale. Feel free to re-open when ready to work on this again. 👍

@frenck frenck closed this Jun 23, 2020
Dev automation moved this from Review in progress to Cancelled Jun 23, 2020
@lock lock bot locked and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Cancelled
Development

Successfully merging this pull request may close these issues.

None yet

8 participants