Sunrise/sunset automation doesn't work

I’ve build my first automation but it doesn’t work. Maybe somebody has an idea and can help to get it running.
What should the automation do?

  • at sunset when nobody is at home, the roller shutters should close
  • at sunrise when nobody is at home, the rollter shutters should open

the automation for sunrise looks like that:

alias: Bei Abwesenheit bei Sonnenaufgang alle Rollläden öffnen
description: ""
triggers:
  - trigger: sun
    event: sunrise
    offset: 0
conditions:
  - condition: and
    conditions:
      - condition: device
        device_id: 1d455c596cdf289e074c91f6174f1deb
        domain: device_tracker
        entity_id: f855fc4d4caa9c3b5d7fc24a4d305a2c
        type: is_not_home
      - condition: device
        device_id: 92c0019e753d02ed0e997f1f645d6111
        domain: device_tracker
        entity_id: 3468595b2e6666dcc8e48da1b0f9bffb
        type: is_not_home
actions:
  - action: knx.send
    metadata: {}
    data:
      response: false
      payload: 0
      address: 3/0/60 3/0/74 3/0/92 3/0/102 3/0/110 3/0/140 3/0/160 3/0/170 3/0/190
mode: single

the devices are our iphones…

Hi @jori0001

I’m not sure why your automation doesn’t work. The code you have provided appears to only deal with the sunrise case. Nevertheless, here’s some things to check.

  • Have you looked to see if there are any traces for the automation to check that it actually gets triggered at sunrise?
  • Have you tried testing the conditions in the automation editor to see if the conditions are met or not met when your phones are at home or not. Try putting them into airplane mode to simulate being away. You can test conditions from each conditions’s 3-dot menu.
  • Have you tried running the action that opens the blinds to see if it works? You can run an action from the 3-dot menu for that action.

Good luck

Hi :wave:!

I don’t think this is valid. Try converting it to a list of strings.
Eg. ["1/2/3", "4/5/6"] or

address:
  - 1/2/3
  - 4/5/6

Alternatively:

address: 3/0/60, 3/0/74, 3/0/92, 3/0/102, 3/0/110, 3/0/140, 3/0/160, 3/0/170, 3/0/190

This aren’t technically problems, but fyi conditions are treated as ANDs by default, you don’t need an AND condition to wrap them in at the top. Also, if you use state conditions instead of device conditions, you’ll be able to use the easier to read entity ids of the device trackers.

I think this would result in a single string too.
Pasting it to YAML to JSON Converter Online would confirm that.

Thanks for your answers…

templeton_nash
Good ideas, I will check if I can find something.

farmio
It’s looking better now. I changed the config to

address:
  - 1/2/3
  - 4/5/6

And it worked when I manually tested the automation. Thanks. Let’s see if it also automatically works.

tom_l
Sorry, this was my first post here. I wasn’t aware that I used “direct messaging.” To be honest, I don’t even know what that is. :joy:
But I’ll take another look at it to make sure it doesn’t happen again and try to do it correctly next time.

Sorry missed the brackets. Should be:

address: [3/0/60, 3/0/74, 3/0/92, 3/0/102, 3/0/110, 3/0/140, 3/0/160, 3/0/170, 3/0/190]
1 Like