Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 102472

Light automation with sun and weather

$
0
0

@martymarty004 wrote:

Hi,
I want to update my automation that triggers X minutes before sunset, adding a second condition that makes the automation trigger even earlier if the weather is cloudy or rainy.

Here’s the result of the automation I made with the frontend:

Working automation before the update

trigger:
  - event: sunset
    offset: -00:15:00
    platform: sun
  condition: []
  action:
  - data:
      brightness: 128
    entity_id: light.lampada_sala
    service: light.turn_on

(it turns on a light at 50% brightness 15 minutes before sunset)

Not working automation after the update (the weather integration I use is Met.no)

trigger:
  - event: sunset
    offset: -00:40:00
    platform: sun
  condition:
  - condition: and
    conditions:
    - condition: state
      entity_id: weather.casa
      state: cloudy
    - condition: or
      conditions:
      - condition: state
        entity_id: weather.casa
        state: rainy
  - condition: or     #<--- I'm unsure about this
    conditions:
    - after: sunset
      after_offset: -00:15:00
      before: sunset
      before_offset: -00:40:00
      condition: sun
  action:
  - data:
      brightness: 128
    entity_id: light.lampada_sala
    service: light.turn_on

(it should turn on the light 40 minutes before sunset if it’s rainy or cloudy, or turn it on 15 minutes before sunset (according to my reasoning).

If someone is able to help me (I bet most of you can) I will be very happy to listen and learn from my errors.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 102472

Trending Articles