Add light control to Sleepiq integration#31322
Conversation
| """Icon to use in the frontend, if any.""" | ||
| return ICON | ||
|
|
||
| async def async_turn_on(self): |
There was a problem hiding this comment.
| async def async_turn_on(self): | |
| def turn_on(self): |
This integration isn't async so you'll need to avoid doing I/O in async.
| """Instruct the light to turn on.""" | ||
| self.turn_on() | ||
|
|
||
| async def async_turn_off(self): |
There was a problem hiding this comment.
| async def async_turn_off(self): | |
| def turn_off(self): |
| add_entities(dev) | ||
|
|
||
|
|
||
| class SleepNumberLight(sleepiq.SleepIQLight): |
There was a problem hiding this comment.
The base class for this should be a Light
from homeassistant.components.light import Light
|
|
||
| def __init__(self, sleepiq_data, bed_id, light): | ||
| """Initialize the light.""" | ||
| sleepiq.SleepIQLight.__init__(self, sleepiq_data, bed_id, light) |
There was a problem hiding this comment.
Please remove this and pass in what you need from setup_platform
| if discovery_info is None: | ||
| return | ||
|
|
||
| data = sleepiq.DATA |
There was a problem hiding this comment.
It looks like this will already be up to date in init so you shouldn't need to update again here.
I realize this is existing in init but we shouldn't use globals. You can fix this by storing the data in
hass.data[DOMAIN] = DATA
Then you can access it in setup_platform
DATA = hass.data[DOMAIN]
DATA should probably be renamed as well.
| @@ -0,0 +1,127 @@ | |||
| """The tests for SleepIQ light platform.""" | |||
There was a problem hiding this comment.
Thanks for adding tests!!!
Please remove the classes from the tests. A good example of how tests should be written is tests/components/wled
bdraco
left a comment
There was a problem hiding this comment.
Thanks for submitting this PR! Please see my comments inline above.
|
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. |
Proposed change
Additions to the Sleepiq integration to enable control of the under bed and nightstand lights.
Type of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale: