Hello there, I’m not sure what is wrong here. But I can’t get this script to run. I am getting this error:
call_service at pos 1: expected float for dictionary value @ data['brightness_pct']
I want the value of brightness_pct to change to 25 or 10 depending on the if else time condition.
This is the script:
dim_living_room_lights_script:
alias: Dim Living Room Lights
sequence:
- service: light.turn_on
data_template:
entity_id: light.orb_light
transition: '60'
kelvin: '2700'
brightness_pct: >-
{% if (now().hour >= 22) and (now().hour < 2) %}
25
{% elif (now().hour >= 2) and (now().hour < 3) %}
10
{% else %}
script.dead
{% endif %}
mode: single
However, my other script that has brightness_pct works fine. It has an identical structure, but with now() in the if else statement, I’m getting an error.
This is the script that works:.
bedroom_lights_on_script:
alias: Bedroom Lights Script
sequence:
- service: light.turn_on
data_template:
entity_id: group.bedroom_lights
transition: '300'
kelvin: '3500'
brightness_pct: >-
{% if (is_state('media_player.sony_bravia_tv', 'playing') or is_state('media_player.apple_tv', 'playing')) %}
10
{% else %}
65
{% endif %}
Can anybody tell me what is going on here and how I can fix it?
Thanks.