Hi!
I am new to HA and still struggling with the configuration. The following does not want to work. It also shows a “Unsupported action:” error in the GUI.
- id: '1570730536258'
alias: Schuhzimmer an aus
trigger:
- platform: state
entity_id: binary_sensor.tradfri_motion_sensor
to: 'on'
- platform: state
entity_id: binary_sensor.tradfri_motion_sensor
to: 'off'
for:
minutes: 10
action:
entity_id: switch.fibaro_system_fgs213_switch_switch_2
service_template: >
{% if trigger.to_state.state == 'on' %}
light.turn_off
{% elif trigger.to_state.state == 'off' %}
light.turn_on
{% else %}
{% endif %}
Your example needs to include data_template because the data supplied to the service includes templates (your example’s entity_id uses a template). In MatthiasR’s example, none of the data supplied to the service uses a template, so it doesn’t need data_template.
Mutt, that’s part of my automation with motion sensor, when the dinner_table_light is on, i.e. eating dinner, I don’t want the motion sensor to control kitchen lights at all.
No, in the OP’s example, data: is not required because the only data presented is entity_id (which is understood to be data for the service without explicitly supplying the option word data:).
That is poor coding, just put a condition in the other automation.
The danger being that you ‘may’ leave the automation in an unknown state should something unexpected happen (say a reboot)