Closed and217 closed 5 years ago
Support for this lamp is already in the lib called python-miio. What’s temporary missing is an update in HA component. Just wait till @syssi will add it there for the device to be properly recognized.
Opened a pull request to add basic philips.light.moonlight support.
Thanks @speedy-beaver I hope that @syssi can find some time to implement it soon! 😄
The Philips Moonlight Bedside Lamp is supported now. Please give it a try!
Hello @syssi Thanks for the update. Here's what I got if I comment the model line or insert model: philips.light.moonlight
2018-11-12 12:11:07 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform xiaomi_miio Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform SLOW_SETUP_MAX_WAIT, loop=hass.loop) File "/usr/local/lib/python3.7/asyncio/tasks.py", line 412, in wait_for return fut.result() File "/home/homeassistant/.homeassistant/custom_components/light/xiaomi_miio.py", line 166, in async_setup_platform light = PhilipsMoonlight(host, token) NameError: name 'PhilipsMoonlight' is not defined
@ardeus-ua I updated the python-miio requirement. Version is 0.4.3 is required.
@syssi It gives me the same error with dependency updated
Uh. I will try to reproduce the issue. Sorry for the hassle.
@ardeus-ua I've found the cause. Please update the custom component and try again. If the component works fine I will prepare a pull request for official Home Assistant support.
@syssi Here’s what I got with the latest version Wed Nov 14 2018 17:56:09 GMT+0200 (EET)
xiaomi_miio: Error on device update! Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 251, in _async_add_entity await entity.async_device_update(warning=False) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 347, in async_device_update await self.async_update() File "/home/homeassistant/.homeassistant/custom_components/light/xiaomi_miio.py", line 803, in async_update self._hs_color = self._get_hs(state.rgb) TypeError: _get_hs() missing 1 required positional argument: 'rgb'
@ardeus-ua Fixed! :-)
@syssi here’s the fresh one
Wed Nov 14 2018 18:14:13 GMT+0200 (EET)
xiaomi_miio: Error on device update! Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 251, in _async_add_entity await entity.async_device_update(warning=False) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 347, in async_device_update await self.async_update() File "/home/homeassistant/.homeassistant/custom_components/light/xiaomi_miio.py", line 803, in async_update self._hs_color = self._get_hs(state.rgb) File "/home/homeassistant/.homeassistant/custom_components/light/xiaomi_miio.py", line 829, in _get_hs return color_util.color_RGB_to_hs(red, green, blue) NameError: name 'color_util' is not defined
@syssi Added util.color to imports, changed procedure call in line 829 and after the restart HA created the entity, but I cannot turn it on. Here’s the entity attributes json
{ "min_mireds": 153, "max_mireds": 588, "model": "philips.light.moonlight", "scene": 0, "delayed_turn_off": null, "sleep_assistant": 0, "sleep_off_time": 0, "total_assistant_sleep_time": 15, "brand_sleep": true, "brand": true, "friendly_name": "Bedside Lamp", "supported_features": 3, "custom_ui_state_card": "state-card-custom-ui" }
Are you able to control the light by python-miio (miiocli moonlight
)?
@ardeus-ua I've changed some lines. Please try again! :-)
@syssi now i can switch it on, change color temp and brightness. Features like mode are not appearing. Can it be because of the features set configuration inside the custom component?
What do you mean by "mode"? Which modes are supported. Do you mean scenes? Colours aren't implemented right now. Do you miss additional features?
@syssi, not at all. I’ve noticed parts of the code. Will wait till it happen. Thanks for the current implementation
https://youpin.mi.com/detail?gid=102761