Beginner : Time related question

Hello,
I am new into Home Assistant, but I’ve worked with eg Tuya before. But now I want something but … I don’t know how to tell it to Home Assistant :slight_smile:

When the TV player (Xiaomi Mi Box) is on Pause, the lights should be at 70% => working
When the TV player (Xiaomi Mi Box) is on Play, the lights should be at 25% => working
But now I can’t get it working only between sunset (so every day another time) and sunrise. What do I miss? I can work with time conditions, but I want it BETWEEN those two.

alias: TV Living Pauze > Licht ++
description: ''
trigger:
  - platform: device
    device_id: 5461cdcefae03f07a272552527dd6f5b
    domain: media_player
    entity_id: media_player.mibox_living
    type: paused
  - platform: sun
    event: sunset
    offset: 0
condition:
  - condition: and
    conditions: []
  - condition: and
    conditions: []
action:
  - service: scene.turn_on
    target:
      entity_id: scene.tv_living_pauze
    metadata: {}
mode: single

Could you not simply say:-

  - condition: state
    entity_id: sun.sun
    state: below_horizon

That way it would only trigger when the sun was set. ?

1 Like

Alternatively, if you want literally sunset/sunrise, use an or-condition:


condition:
  - condition: or
    conditions:
      - condition: sun
        before: sunrise
      - condition: sun
        after: sunset

But @Rofo 's approach is much more chic.