syssi / philipslight

Xiaomi Philips Lights integration for Home Assistant
Apache License 2.0
70 stars 19 forks source link

philips.light.moonlight #16

Closed and217 closed 5 years ago

and217 commented 6 years ago

https://youpin.mi.com/detail?gid=102761

ardeus-ua commented 6 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.

speedy-beaver commented 6 years ago

Opened a pull request to add basic philips.light.moonlight support.

iFloris commented 6 years ago

Thanks @speedy-beaver I hope that @syssi can find some time to implement it soon! 😄

syssi commented 5 years ago

The Philips Moonlight Bedside Lamp is supported now. Please give it a try!

ardeus-ua commented 5 years ago

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

syssi commented 5 years ago

@ardeus-ua I updated the python-miio requirement. Version is 0.4.3 is required.

ardeus-ua commented 5 years ago

@syssi It gives me the same error with dependency updated

syssi commented 5 years ago

Uh. I will try to reproduce the issue. Sorry for the hassle.

syssi commented 5 years ago

@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.

ardeus-ua commented 5 years ago

@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'

syssi commented 5 years ago

@ardeus-ua Fixed! :-)

ardeus-ua commented 5 years ago

@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

ardeus-ua commented 5 years ago

@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" }

syssi commented 5 years ago

Are you able to control the light by python-miio (miiocli moonlight)?

syssi commented 5 years ago

@ardeus-ua I've changed some lines. Please try again! :-)

ardeus-ua commented 5 years ago

@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?

syssi commented 5 years ago

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?

ardeus-ua commented 5 years ago

@syssi, not at all. I’ve noticed parts of the code. Will wait till it happen. Thanks for the current implementation