The effects were added to the yeelight component in HA 0.47. I have two YLDP02YL bulbs and when I try to turn on the effect I have error in log and nothing happens:
2017-06-18 13:10:54 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
result = coro.throw(exc)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/core.py", line 1021, in _event_to_service_call
yield from service_handler.func(service_call)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/__init__.py", line 272, in async_handle_light_service
yield from light.async_turn_on(**params)
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/yeelight.py", line 410, in turn_on
self.set_effect(effect)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/yeelight.py", line 98, in _wrap
return func(self, *args, **kwargs)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/yeelight.py", line 374, in set_effect
self._bulb.start_flow(flow)
UnboundLocalError: local variable 'flow' referenced before assignment
I turn on effect by Services tab: light -> turn_on -> { "entity_id": "light.yeelight_color_bulb_salon_1", "effect": "police" }
Itâs issue with component or Iâm doing something wrong?
Oh i see now. It is working. Only the name is case-sensitive.
So this is working: { "entity_id": "light.yeelight_color_bulb_salon_1", "effect": "Police" }
So you can use these effects:
Disco
Slow Temp
Strobe epilepsy!
Strobe color
Alarm
Police
Police2
Christmas
RGB
Random Loop
Fast Random Loop
Slowdown
WhatsApp
Facebook
Twitter
Stop
If I run the script below when the light is turned off it ends up back at the last on state I used, how would I add a command to turn it off again? Probably obvious but this is my first script so be gentle! Thanks.
Iâve written this but the results are random, sometimes you get a momentary dim flash, sometimes it does the two green flashes and then goes back to normal for a second before turning off. Assume there must be a âproperâ way to do this?
I understand what you want to achieve. As of right now there is no nice way to turn it off after the effect in case of notifications.
But i changed line 367 in the yeelight.py file Which for my installation i found here: \srv\homeassistant\lib\python3.4\site-packages\homeassistant\components\light\
into this: flow = Flow(count=2, action=Flow.actions.off, transitions=pulse(37, 211, 102))
So lines 367 changes the Whatsapp effect in going off after it ran. Problem with this is it turns off everytime also when you want the bulb the stay on. So an easy solution i can think of right now is to have two effects. So an WhatsApp and WhatsAppOff effect. Then you can let automations decide to run the WhatsApp effect to run when the bulb is on and the WhatsAppOff effect to run when the bulb is off.
But i think there is still a problem with this change. it seems that turning on and off lights gets quite unresponsive. So thatâs something to look into.
Thanks, this is just what I was after, had seen the bits of code like that but couldnât find any reference to âWhatsAppâ to know for sure âŚwas also afraid of buggering the bulb up if I changed things
Is the unresponsive issue something to do with music mode as I sure it said somewhere that that removes some delay?
To get over the off and on problem I was happy just to use one of the others in itâs original state but how would I go about adding another effect given there doesnât seem to be a direct coloration between whatâs in the menu and whatâs in the code?
But the real effects are coming from the \deps\yeelight\transitions.py file.
If you want to add effects you need to add them to here and than also update/ reference them in the yeelight.py file on the home-assistant github.
What happens if you add another effect after that: âEFFECT_STOPâ ?
Doesnât it return to itâs original state afterwards then (which means âoffâ when the light was off when the automation fired)?
Donât think so, because the light has to be on in the first place to set the effect. so when you use effect_stop itâs last state is on.
What is it you exactly want to achieve: having an effect run only when te bulb is on or having a effect run no matter what if the bulb is on or not. ?
The last one.
But I just tried and indeed the light stays on after the automation unfortunately. I guess two seperate automations is the way to go then.
I was just playing with the fairly new update from the yeelight app. Which enables you to make your own effects and then select them to play on a bulb.
I just discovered that you can activate the effect when the bulb is in âoffâ mode. after the effect ended it goes off again.
So this means it is possible. so maybe to code needs to be altered a bit.
Thatâs the right one i have the same. if you select the hamburger menu in the top left and click on âpersonalisatieâ ( i think yourâs is in dutch aswell?)
then you can create something with the plus icon in the top right.