What I'm doing wrong?

Hi all,

I created an automation to set my covers to a specific position 20 minutes after sunset.
Now I want to get a notification (via Matrix, is already configured) after my covers are below level 0.20

This is not working for me, don’t know what I’m doing wrong. Here som screenshots:


Can you help me please?

Thank you and Regards
Lukas

Please post the correctly-formatted YAML for the automation. Click the three dots top-right, choose Edit in YAML, copy all the code.

Reply to this, and paste the code surrounded by three backticks like this:

```
YOUR CODE HERE
```

alias: Rollladen Schlafzimmer
description: Rollladen im Schlafzimmer nach Sonnenuntergang auf bestimmte Position fahren
trigger:
  - platform: sun
    event: sunset
    offset: "+00:20:00"
condition: []
action:
  - service: cover.set_cover_position
    metadata: {}
    data:
      position: 17
    target:
      entity_id: cover.rollladen_kinderzimmer
  - if:
      - condition: numeric_state
        entity_id: cover.rollladen_kinderzimmer
        attribute: level
        below: 0.2
    then:
      - service: notify.matrix_notify
        metadata: {}
        data:
          message: Rollladen im Schlafzimmer ist heruntergefahren
mode: single
1 Like

It might just be a translation issue, but the automation will set the cover position then immediately check the level in the condition. If it fails (i.e. level attribute not below 0.2) then no notification will be sent.

If you want the automation to “watch” the level and send the notification when (“after”) the level drops below 0.2, then you need the “wait for a trigger” building block:

Thank you, now I’m confused where to build the “wait for trigger” building block in my automation?

If that’s what you need, put it in place of the if block like this in YAML:

alias: Rollladen Schlafzimmer
description: Rollladen im Schlafzimmer nach Sonnenuntergang auf bestimmte Position fahren
trigger:
  - platform: sun
    event: sunset
    offset: "+00:20:00"
condition: []
action:
  - service: cover.set_cover_position
    metadata: {}
    data:
      position: 17
    target:
      entity_id: cover.rollladen_kinderzimmer
  - wait_for_trigger:
      - platform: numeric_state
        entity_id: cover.rollladen_kinderzimmer
        attribute: level
        below: 0.2
  - service: notify.matrix_notify
    metadata: {}
    data:
      message: Rollladen im Schlafzimmer ist heruntergefahren
mode: single

You can set a timeout for the wait, if you need. See here:

1 Like

cool, thank you very much, is working now :slight_smile:

1 Like