Hi All,
I have follow script. But it seems this is not working because of the if statement maybe:
normal_normal_turn_on:
alias: Normal Turn On
sequence:
- service: light.turn_on
data:
entity_id: light.livingroom_all
kelvin: 2700
brightness_pct: 100
- service: light.turn_on
data:
entity_id: light.balcony
brightness_pct: 100
effect: 0
- service_template: >
{% if states.binary_sensor.node_10.state == 'on' %} light.turn_off
{% else %} light.turn_on
{% endif %}
data:
entity_id: light.dressoir_all
kelvin: 2700
brightness_pct: 100
this script is called by follow automation. I have a if statement at end of this automation.
It check if there is a holiday. If so then it will call a script action.
Example see above. but it runs the first service call but then it stop and give a error:
Error executing script script.normal_normal_turn_on. Invalid data for call_service at pos 2: extra keys not allowed @ data[‘kelvin’]
Error while executing automation automation.scene_evening. Invalid data for call_service at pos 5: extra keys not allowed @ data[‘kelvin’]
- alias: Scene - Evening
trigger:
- platform: time_pattern
minutes: /1
- entity_id: device_tracker.geofency_peter
platform: state
to: home
- entity_id: device_tracker.geofency_kay
platform: state
to: home
- entity_id: sensor.harmony
platform: state
to: 'Off'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: state
entity_id: input_boolean.scene_evening
state: 'off'
- condition: state
entity_id: input_boolean.scene_goodnight
state: 'off'
- condition: state
entity_id: sensor.harmony
state: 'Off'
- condition: or
conditions:
- condition: state
entity_id: device_tracker.geofency_peter
state: home
- condition: state
entity_id: device_tracker.geofency_kay
state: home
action:
- service: notify.pushover
data:
message: Scene evening is activated
- service: input_boolean.turn_on
data:
entity_id: input_boolean.scene_evening
- service: input_boolean.turn_off
entity_id:
- input_boolean.scene_kodi
- input_boolean.scene_tv
- input_boolean.scene_iptv
- input_boolean.scene_daylight
- input_boolean.scene_appletv
- input_boolean.scene_sexy
# NANOLEAF LIGHT
- service: light.turn_on
entity_id: light.nanoleaf
data_template:
brightness_pct: 50
effect: >
{% if states.input_select.select_holiday.state == "Christmas" %} Christmas
{% elif states.input_select.select_holiday.state == "Easter" %} Easter
{% elif states.input_select.select_holiday.state == "Halloween" %} Halloween
{% elif states.input_select.select_holiday.state == "Kingsday" %} Kingsday
{% elif states.input_select.select_holiday.state == "Bday" %} Fireplace
{% else %} NorthernLight
{% endif %}
# LIGHT
- service_template: >
{% if states.input_select.select_holiday.state == "Christmas" %} script.christmas_normal_turn_on
{% elif states.input_select.select_holiday.state == "Halloween" %} script.halloween_normal_turn_on
{% elif states.input_select.select_holiday.state == "Kingsday" %} script.kingsday_normal_turn_on
{% elif states.input_select.select_holiday.state == "Bday" %} script.birthday_normal_turn_on
{% elif states.input_select.select_holiday.state == "Nothing" %} script.normal_normal_turn_on
{% endif %}
Can someone see the issue here?