Add Elk light platform#17222
Add Elk light platform#17222MartinHjelmare merged 6 commits intohome-assistant:devfrom gwww:elkm1-light
Conversation
|
The light platform module is missing. |
|
Whadda mean you need to do a |
MartinHjelmare
left a comment
There was a problem hiding this comment.
Please add a guard clause to the alarm_control_panel platform too. See below.
| elk = hass.data[ELK_DOMAIN]['elk'] | ||
| async_add_entities( | ||
| create_elk_entities(hass, elk.lights, 'plc', ElkLight, []), True) | ||
| return True |
There was a problem hiding this comment.
Nothing is checking this return value. Please remove the statement.
|
|
||
| @property | ||
| def is_on(self) -> bool: | ||
| """Is there light?""" |
There was a problem hiding this comment.
Please write the docstring in imperative mood and end with period.
| return self._brightness != 0 | ||
|
|
||
| def _element_changed(self, element, changeset): | ||
| """Callback handler from the Elk.""" |
| self._brightness = round(status * 2.55) | ||
|
|
||
| async def async_turn_on(self, **kwargs): | ||
| """Let there be light!""" |
There was a problem hiding this comment.
Please keep docstrings formal.
| self._element.level(round(kwargs.get(ATTR_BRIGHTNESS, 255) / 2.55)) | ||
|
|
||
| async def async_turn_off(self, **kwargs): | ||
| """In the darkness...""" |
|
|
||
|
|
||
| async def async_setup_platform( | ||
| hass, config, async_add_entities, discovery_info=None): |
There was a problem hiding this comment.
continuation line with same indent as next logical line
| async def async_setup_platform(hass, config, async_add_entities, | ||
| discovery_info): | ||
| async def async_setup_platform( | ||
| hass, config, async_add_entities, discovery_info=None): |
There was a problem hiding this comment.
continuation line with same indent as next logical line
| for component in SUPPORTED_DOMAINS: | ||
| hass.async_create_task( | ||
| discovery.async_load_platform(hass, component, DOMAIN)) | ||
| discovery.async_load_platform(hass, component, DOMAIN, [])) |
There was a problem hiding this comment.
We usually put an empty dict for discovery_info.
|
Thank you. |
Description:
Related issue (if applicable): fixes #
Pull request in home-assistant.io with documentation (if applicable):
home-assistant/home-assistant.io#6590
Example entry for
configuration.yaml(if applicable):Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices: