I have set up the following automation but it isn’t turning off the lights. I get the notification staying that it is turning off the lights.
- alias: Light's Left On!!!
trigger:
platform: state
entity_id: group.trackers
to: 'not_home'
action:
- service: notify.pushover
data_template:
title: "Alert"
message: "No One Is Home And The Lights Were Left On. I Turned Them Off For You"
- service: light.turn_off
entity_id: group.all_lights
So it looks like I may have found the issue. It appears it isn’t with my automation but with bellows or my installation.
2018-01-29 15:57:24 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall light.turn_off: entity_id=['group.all_lights']>
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.6/site-packages/homeassistant/core.py", line 1010, in _event_to_service_call
yield from service_handler.func(service_call)
File "/srv/homeassistant/homeassistant_venv/lib/python3.6/site-packages/homeassistant/components/light/__init__.py", line 272, in async_handle_light_service
yield from light.async_turn_off(**params)
File "/srv/homeassistant/homeassistant_venv/lib/python3.6/site-packages/homeassistant/components/light/zha.py", line 131, in async_turn_off
yield from self._endpoint.on_off.off()
File "/srv/homeassistant/homeassistant_venv/lib/python3.6/site-packages/bellows/zigbee/application.py", line 284, in request
v = yield from send_fut
File "/usr/local/lib/python3.6/asyncio/futures.py", line 332, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
future.result()
File "/usr/local/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
bellows.zigbee.exceptions.DeliveryError: Message send failure: EmberStatus.DELIVERY_FAILED
Here is how I have my automation to cause this error.
- alias: Light's Left On!!!
trigger:
platform: state
entity_id: group.trackers
to: 'not_home'
action:
- service: light.turn_off
entity_id: group.all_lights
- service: notify.pushover
data_template:
title: "Alert"
message: "No One Is Home And The Lights Were Left On. I Turned Them Off For You"
and
- alias: Light's Left On!!!
trigger:
platform: state
entity_id: group.trackers
to: 'not_home'
action:
- service: homeassistant.turn_off
entity_id: group.all_lights
- service: notify.pushover
data_template:
title: "Alert"
message: "No One Is Home And The Lights Were Left On. I Turned Them Off For You"
The light it is complaining about is not currently installed or even one of the lights that is turned on. It is also the first light in my list of 32.
Thank you. I will try that and see if the automation works better. I have a strange feeling it won’t as some of the lights get turned off by a switch so they will also be unreachable. Which makes me think I need a script to check which lights are reporting on and then just turn those off.
The next version of the Yoda new-zha I posted earlier has polling, so it will know if the light is already off – that might help you.
Alternatively, instead of using group.all_lights, you might try breaking it up into smaller groups, say one group per circuit or switch, and then calling light.turn_off for each group.