Hello guys!
Can someone help me please? Since updating to version 0.84, this script does not work anymore, could not figure it out:
casa_desligar_tudo:
alias: "Desligar tudo em casa"
sequence:
- service: climate.set_operation_mode
data_template:
operation_mode: 'off'
entity_id: >
{% for device in states if not device.state == 'off' and (device.entity_id in ['climate.ar_condicionado_da_suite','climate.ar_condicionado_do_quarto','climate.ar_condicionado_da_sala']) -%}
{%- if loop.first %}{{ device.entity_id }}{% else %}, {{ device.entity_id }}{% endif -%}
{% endfor %}
- service_template: light.turn_off
data_template:
entity_id: >
{% for device in states if device.state == 'on' and ( device.entity_id in ['light.area_servico','light.suite_banheiro_principal','light.suite_banheiro_espelho','light.corredor','light.cozinha','light.entrada','light.ledchaocozinha','light.ledcozinhabalcao','light.ledquartotv','light.ledsaladesktop','light.ledsalatv','light.ledsuitecama','light.ledsuitetv','light.mesa_jantar','light.quarto','light.sala_principal','light.banheiro_social_principal','light.banheiro_social_espelho','light.suite_principal'] ) -%}
{%- if loop.first %}{{ device.entity_id }}{% else %}, {{ device.entity_id }}{% endif -%}
{%- endfor %}
- service_template: switch.turn_off
data_template:
entity_id: >
{% for device in states if device.state == 'on' and ( device.entity_id in ['switch.chuveirosuite','switch.toalheiro','switch.tv_lg_sala','switch.tv_lg_suite','switch.chuveirosocial','switch.tv_lg_quarto','switch.cafeteira_casa','switch.chaleira_casa','switch.ventilador_casa','switch.home_theater_sala'] ) -%}
{%- if loop.first %}{{ device.entity_id }}{% else %}, {{ device.entity_id }}{% endif -%}
{%- endfor %}
- service: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.alarme
I use this on my house entrance tablet, so I can turn off everything that is currently on and disarm the alarm.
Now I get this:
Log Details (ERROR)
Fri Dec 14 2018 14:35:47 GMT-0200 (HorĂĄrio de VerĂŁo de BrasĂlia)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 277, in _handle_service_platform_call
await getattr(entity, func)(**data)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/switch/template.py", line 158, in async_turn_off
await self._off_script.async_run(context=self._context)
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/script.py", line 130, in async_run
await self._handle_action(action, variables, context)
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/script.py", line 172, in _handle_action
action, variables, context)
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/script.py", line 261, in _async_call_service
context=context
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 81, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context)
File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1121, in async_call
self._execute_service(handler, service_call))
File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1143, in _execute_service
await handler.func(service_call)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/script.py", line 123, in service_handler
context=service.context)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/script.py", line 181, in async_turn_on
kwargs.get(ATTR_VARIABLES), context)
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/script.py", line 130, in async_run
await self._handle_action(action, variables, context)
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/script.py", line 172, in _handle_action
action, variables, context)
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/script.py", line 261, in _async_call_service
context=context
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 81, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context)
File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1101, in async_call
processed_data = handler.schema(service_data)
File "/usr/local/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 267, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 589, in validate_dict
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 427, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: Entity ID "" is an invalid entity id for dictionary value @ data['entity_id']
If someone could make this script better, I really appreciate the help.
Maybe the great @petro could solve this puzzle, again!
Thanks guys!