Thanks to help from this forum I managed to get the service call to function.
But now I would like to add some data to the call. And whatever I tried, I only ever got “Error rendering data template: Result is not a Dictionary” as a result.
Additionally when an event occurs that I want to ignore, e.g. button up, I get “Template rendered invalid service: {}”
Any help is greatly appreciated.
alias: AAA DECONZ
description: ""
trigger:
- platform: event
event_type: deconz_event
condition:
- condition: template
value_template: "{{ trigger.event.data.device_id == '40b0175e4f8a454fca785268c10c49b5' }}"
action:
- service: logbook.log
data:
name: Button
message: "{{ trigger.event.data.event }} on {{ trigger.event.data.id }}"
- service: >
{% if trigger.event.data.event == 1000 %}
{{ 'light.turn_on' }}
{% elif trigger.event.data.event == 2000 %}
{{ 'light.turn_on' }}
{% elif trigger.event.data.event == 3000 %}
{{ 'light.turn_on' }}
{% elif trigger.event.data.event == 4000 %}
{{ 'light.turn_off' }}
{% else %}
{}
{% endif %}
data: >
{
{% if trigger.event.data.event == 1000 %}
{}
{% elif trigger.event.data.event == 2000 %}
{ "brightness_step_pct" : 10 }
{% elif trigger.event.data.event == 3000 %}
{{ 'brightness_step_pct: "-10"' }}
{% elif trigger.event.data.event == 4000 %}
{}
{% else %}
{}
{% endif %}
}
entity_id: light.color_temperature_light_15
mode: single