So I am trying to make some automation for my outdoor lights. The lights are dimmable and I have made a group of light.utelys which work as intended. I have written automation that do turn on/off at sunset/sunrise. The I have been trying to implement a card in dashboard with a adjustable timer, and a slider to set a amount of light. The idea is to be able to set light to a lower dimlevel after bedtime and have the opprtunity to adjust this. I will try to provide my codes and hope someone could have a look on them telling me where I go wrong.
EDIT: Whats the Issue? Lights come an at sunset, I assume. Will know that for sure later this evening. Lights do go off at sunrise. What does not function is the “time and slider”, which is supposed to set the dimlevel, from the time I set in the card and which shall stay there until sunrise. Nothing happens when the time is there. I tried to write an automation where the lights should go on if i manipulated the slider(input_number.outside_light_manual and that worked out fine.
I have a Input_number.yaml
outside_light_level:
name: "Utelys lysnivĂĄ"
initial: 50
min: 0
max: 100
step: 1
outside_light_manual:
name: "Utelys manuell justering"
initial: 0
min: 0
max: 100
step: 1
And I have a input_datetime.yaml
outside_light_time:
name: Lysstyrke endres
has_date: false
has_time: true
I even have a input_boolean.yaml
summer_mode:
name: Sommer
initial: off
icon: mdi:weather-sunny
I have added this in configuration.yaml
input_boolean: !include input_boolean.yaml
input_number: !include input_number.yaml
input_datetime: !include input_datetime.yaml
I have the card which is in Dwains Dashboard
type: vertical-stack
cards:
- entities:
- entity: input_datetime.outside_light_time
type: entities
- entity: input_number.outside_light_manual
hide_state: false
max: 100
min: 0
name: LysnivĂĄ fra klokken
step: 5
type: 'custom:slider-entity-row'
- entity: light.utelys
hide_state: false
max: 100
min: 0
name: LysnivĂĄ
step: 5
type: 'custom:slider-entity-row'
- color: auto
entity: input_boolean.summer_mode
icon: 'mdi:weather-sunny'
name: Sommer
show_state: true
tap_action:
action: toggle
type: 'custom:button-card'
col_span: '2'
col_span_lg: '2'
col_span_xl: '2'
position: top
row_span: '1'
row_span_lg: '1'
row_span_xl: '1'
And finally I have the automation
- id: '1684051552179'
alias: Set Outside Lights at Sunset
trigger:
platform: sun
event: sunset
action:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.summer_mode
state: 'off'
sequence:
- service: light.turn_on
entity_id: light.utelys
data_template:
brightness_pct: "{{ state_attr('input_number.outside_light_level', 'value') | int }}"
- default:
sequence:
- service: light.turn_on
entity_id: light.utelys
data:
brightness_pct: 80
- id: '1684051552180'
alias: Turn Off Outside Lights at Sunrise
trigger:
platform: sun
event: sunrise
action:
- service: light.turn_off
entity_id: light.utelys
- id: '1684051552181'
alias: Adjust Outside Light Level
trigger:
platform: time
at: input_datetime.outside_light_time
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: input_number.outside_light_manual
above: 0
sequence:
- service: light.turn_on
entity_id: light.utelys
data_template:
brightness_pct: "{{ state_attr('input_number.outside_light_manual', 'value') | int }}"
- default:
- service: light.turn_off
entity_id: light.utelys
Here is a screenshot from the dashboard as well
Hope someone is able to help me a bit here, as I am stuck at the moment.
Best regards
Freddy