Smulemus
(Smule Mus)
October 16, 2023, 12:08pm
1
I am trying to configure an adaptive lighting setup in the YAML file.
I have created a sensor to output next sunset in 00:00:00 format.
How can i include a entity value in this code:
adaptive_lighting:
- name: "Test"
lights:
# ... (other configurations)
sunrise_time: sensor.tid_soloppgang
# ... (other configurations)
This code gices me this error:
Invalid config for [adaptive_lighting]: Invalid time specified: sensor.tid_soloppgang for dictionary value @ data['adaptive_lighting'][0]['sunrise_time']. Got 'sensor.tid_soloppgang'. (See /config/configuration.yaml, line 122).
Note: If i set the sunrise_time to 08:00:00 it works.
steriku
October 16, 2023, 12:14pm
2
Youād have to use template format for this value to be populated.
${{ states(āsensor.tid_soloppgangā) }}
1 Like
Smulemus
(Smule Mus)
October 16, 2023, 4:48pm
3
That did not work. Got this error:
Invalid config for [adaptive_lighting]: Invalid time specified: ${{ states(āsensor.tid_soloppgangā) }} for dictionary value @ data['adaptive_lighting'][0]['sunrise_time']. Got '${{ states(āsensor.tid_soloppgangā) }}'
Invalid time specified: ${{ states(āsensor.tid_soloppgangā) }} for dictionary value @ data['adaptive_lighting'][0]['sunset_time']. Got '${{ states(āsensor.tid_soloppgangā) }}'. (See /config/configuration.yaml, line 122).
My configuration.yaml file code :
adaptive_lighting:
- name: "Test"
lights:
- light.spilevegg_spot_1
- light.spilevegg_spot_2
- light.spilevegg_spot_3
- light.gang_vegg_spot_1
- light.gang_vegg_spot_2
- light.dimmable_light_1
- light.downligts_spotkasse
- light.gang_tak
- light.kjokken_tak
- light.soverom_tak
prefer_rgb_color: false
brightness_mode: 'tanh'
transition: 45
initial_transition: 1
interval: 90
min_brightness: 30
max_brightness: 89
min_color_temp: 2000
max_color_temp: 5500
sleep_brightness: 1
sleep_color_temp: 1000
brightness_mode_time_dark: 3700
brightness_mode_time_light: 1
sunrise_time: ${{ states(āsensor.tid_soloppgangā) }}
sunrise_offset: 0
sunset_time: ${{ states(āsensor.tid_soloppgangā) }}
sunset_offset: 0 # in seconds or '00:30:00'
take_over_control: true
detect_non_ha_changes: false
only_once: false
My sensor.yaml file:
- platform: template
sensors:
tid_soloppgang:
value_template: "{{ as_timestamp(state_attr('sun.sun', 'next_rising')) | int | timestamp_custom('%H:%M:%S') }}"
tid_solnedgang:
value_template: "{{ as_timestamp(state_attr('sun.sun', 'next_setting')) | int | timestamp_custom('%H:%M:%S') }}"
I added a $ where I shouldnāt have, try without it
1 Like
Smulemus
(Smule Mus)
October 16, 2023, 6:13pm
5
Not allowed:
Code:
adaptive_lighting:
- name: "Test"
lights:
- light.spilevegg_spot_1
- light.spilevegg_spot_2
- light.spilevegg_spot_3
- light.gang_vegg_spot_1
- light.gang_vegg_spot_2
- light.dimmable_light_1
- light.downligts_spotkasse
- light.gang_tak
- light.kjokken_tak
- light.soverom_tak
prefer_rgb_color: false
brightness_mode: 'tanh'
transition: 45
initial_transition: 1
interval: 90
min_brightness: 30
max_brightness: 89
min_color_temp: 2000
max_color_temp: 5500
sleep_brightness: 1
sleep_color_temp: 1000
brightness_mode_time_dark: 3700
brightness_mode_time_light: 1
sunrise_time: {{ states(āsensor.tid_soloppgangā) }
sunrise_offset: 0
sunset_time: {{ states(āsensor.tid_solnedgangā) }
sunset_offset: 0 # in seconds or '00:30:00'
take_over_control: true
detect_non_ha_changes: false
only_once: false
Error in yaml:
missed comma between flow collection entries (154:3)
151 | brightness_mode_time_dark: 3700
152 | brightness_mode_time_light: 1
153 | sunrise_time: {{ states(āsensor ...
154 | sunrise_offset: 0
---------^
155 | sunset_time: {{ states(āsensor. ...
156 | sunset_offset: 0 # in seconds o ...