Help with automated lights

I currently have the following automation for my landing light, however looking for some help to achieve the following:

from sunset to 23:00 I want it to do exactly what it does now, however from 23:00 to sunrise I want the light to only come on to 5%

how would I go about doing that?

my current automation: https://pastebin.com/NnQdqt7F

Please format your YAML code properly following the instructions at the top of the page. As it is, it is very difficult to read.

1 Like

You can use conditions in the action as well. (https://www.home-assistant.io/docs/automation/action/)

When posting configuration snippets please use code blocks and syntax highlighting.

sorry, quite new to this, I’ve pasted it into pastebin https://pastebin.com/NnQdqt7F

You might want to add something like the following snippet (untested) in your action part of your automation.

      - service: light.turn_on
        data:
          brightness_pct: 5
          entity_id: light.yeelight_landing
      - condition: time
        before: '23:00'
      - service: light.turn_on
        data:
          brightness_pct: 100
          entity_id: light.yeelight_landing
1 Like

Pasting code here is fine. Just use proper tags to format your code.

```yaml
  - condition: time
    before: '23:00'
```

I would use a data_template:

    - service: homeassistant.turn_on
      entity_id: light.yeelight_landing
      data_template:
        brightness_pct: "{{ 5 if now().hour >= 23 else 100 }}"
2 Likes