Open JoshSald opened 3 years ago
I am running into the same error when invoking yeelight_v2.set_color_flow_scene. Here is the error message in the log:
2021-03-01 14:07:15 ERROR (MainThread) [homeassistant.components.automation.test] While executing automation automation.test
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 404, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1033, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 246, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 254, in _async_step
await getattr(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 464, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1455, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1490, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 575, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 595, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 632, in _handle_entity_call
await result
File "/config/custom_components/yeelight_v2/light.py", line 358, in _async_set_color_flow_scene
transitions=_transitions_config_parser(
File "/config/custom_components/yeelight_v2/light.py", line 228, in _transitions_config_parser
transition_objects.append(getattr(yeelight, transition)(*params))
NameError: name 'yeelight' is not defined
It looks like the original yeelight/light.py file had an import yeelight
at the top of the file, but that line does not exist in the yeelight_v2 version of the file.
After added the from/import line below to my local light.py file, yeelight_v2.set_color_flow_scene now works for me.
flows,
transitions as yee_transitions,
)
**from .python_yeelight import yeelight**
from .python_yeelight.yeelight.enums import BulbType, LightType, PowerMode, Scen
from homeassistant.components.light import (
Please update the repo with this fix.
After added the from/import line below to my local light.py file, yeelight_v2.set_color_flow_scene now works for me.
flows, transitions as yee_transitions, ) **from .python_yeelight import yeelight** from .python_yeelight.yeelight.enums import BulbType, LightType, PowerMode, Scen from homeassistant.components.light import (
Please update the repo with this fix.
Thanks updated!
Adding custom_effects to the config makes the lights unavailable and using
yeelight_v2.set_color_flow_scene
for example seems to result in a "name 'yeelight' is not defined" error. I haven't tested all the otheryeelight_v2.services
just yet, butset_color_scene
, for example, seems to be working fine.