I use two different ceiling lights: ceiling1 YLXD01YL
and one that is not mentioned in the list of supported models, but it works, is available in yeelight mobile application and has moonlight feature:
Xiaomi Mi MiJia LED Ceiling Light
I have a ceiling4 (it has a sensor) and 2 ceiling1 lights. The ceiling1 has moonlight support, I use it at the night light automation from since the beginning. Iāll try to call the yeelight.set_mode: normal at the widget.
The underlying library needs to be updated to enable the moonlight support for ceiling1 and celiling2. We will care about. At the moment ceiling3 and 4 is supported only.
Thank you for this explanation. This makes sense, although Iād prefer that the light has the mode that it had when I switched it off (i.e., stay at moonlight). However, thanks to lovelace, it should be no problem with conditional cards to achieve both with your the planned two-lights-approach. So I am happy and will arrange with whatever you implement
I can already see there are some use cases for not having separate light entities. I will look at adding some config option, like moonlight_switch_type, with default value to ānoneā and optional values āseparate_lightā etc. It would also allow to add brightness slider moonlight / daylight switch option, as suggested by @zoe1337.
@thawizard I donāt think its possible now. Maybe using some custom lovelace cards ?
Thats the only change in 0.91.1 https://github.com/home-assistant/home-assistant/pull/22756/files . Iām also running 0.91.1 and donāt have that problem. Whats your setup ? Looks like some kind of race condition in libs import ? Maybe it tries to import yeelight component as python-yeelight ? Did you change anything before upgrade ?
I am running hass.io on Ubuntu server, nothing special. On 0.91.0 I installed this:
and worked fine.
Today I upgraded to 0.91.1 and got the problem above. I restarted multiple times, not helped. I moved yeelight from custom_components folder then restarted, not helped.
Back to 0.91.0 Yeelights are found and working as usual.
_frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('yeelight.enums') at 140112646206184
2019-04-06 18:43:18 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up platform yeelight
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/yeelight/binary_sensor.py", line 21, in setup_platform
if device.is_nightlight_supported:
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/yeelight/__init__.py", line 235, in is_nightlight_supported
return self.bulb.get_model_specs().get('night_light', False)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/yeelight/__init__.py", line 188, in bulb
import yeelight
File "/usr/local/lib/python3.7/site-packages/yeelight/__init__.py", line 5, in <module>
from yeelight.main import Bulb, BulbException, discover_bulbs
File "/usr/local/lib/python3.7/site-packages/yeelight/main.py", line 11, in <module>
from .enums import BulbType, LightType, PowerMode
File "<frozen importlib._bootstrap>", line 980, in _find_and_load
File "<frozen importlib._bootstrap>", line 149, in __enter__
File "<frozen importlib._bootstrap>", line 94, in acquire
_frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('yeelight.enums') at 140112646206184
Can you describe your setup ? I donāt have that error :\ ( Are you using hassio, how HA is installed ). Iāve looked at code and optimized some imports, lets hope it will solve it. Can you try this code and see if it solved issue for you ? https://github.com/home-assistant/home-assistant/pull/22804.
EDIT: Iāve found out why custom_component didnāt worked well. It needs to use relative imports, and it was missed from auto relative imports migration, because it was not a component there. This should fix it https://github.com/home-assistant/home-assistant/pull/22839/files
Previously I used the yeelight set mode only at night light automation and it is worked well. Now it doesnāt work perfectly because the moonlight mode uses the brightness off previous daylight setup maybe because it is very bright, therefore I have to call the light switch on service with brightness attribute too. It is working but not exactly smooth, noticeably slower than before. I have only one benefit for me with the new platform so far, this is the ambilight.
Maybe would be better the moonlight function as a separate entity like the ambilight at the ceiling4.
I just retested it and when switching moonlight / daylight via set_mode, it uses correct brightness. When you switch mode, HA will now read brightness from correct property ( before it was always returning daylight brightness in ui ). Same bug exist in yeelight app. When you switch between daylight and moonlight, brightness slider stays at the same place. In new yeelight code in HA it should work as expected, after mode switch, it should change brightness. Try to set moonlight, change brightness, set normal mode, change to other brightness and set moonlight again and check brightness then plz.