Outside light with the option to set a light and time level in a card

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

Thorough documentation :+1:
You just forgot to tell what’s the issue :wink:

1 Like

Edit in main post

Did you check if the Adjust Outside Light Level automation was run, and if yes, its traces?
I assume input_datetime.outside_light_time is has_date: false and has_time: true ?

Have been looking but here is some stuff I dont understand because this automations arent to be found under automations instead I find them placed under “Helpers”

Adjust Outside Light Level? Screenshot please
From which file is the above extract from? automations.yaml?


This is what I find under helpers.
and this is everything i find regarding to outdoor lights in my atomations

Yes it is from automations.yaml

Please take a screenshot of the “A”, like “Adjust…”

Here it is

So it seems just no there.

Did you edit automations.yaml manually and forgot to reload?
Nothing in the logs?

Reloaded a lot of times as I am moving my system from another system to home assistant. Going to do a reload no as I have done another automation. Will check the logs again.

Done some corrections of the indentation level, gonna try again.

The solution was indeed in the automation yaml, had to rewrite it. Now it works as I wanted it to.

- 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
              target:
                entity_id: light.utelys
              data:
                brightness_pct: >
                  {% set manual_value = states('input_number.outside_light_manual') %}
                  {% if manual_value %}
                    {{ manual_value | int }}
                  {% else %}
                    20
                  {% endif %}
        - conditions: []
          sequence:
            - service: light.turn_off
              target:
                entity_id: light.utelys