Roller blind automation for closer

Hello all,

I have an automation to close roller blinds equiped with shelly.
The goal is to close based on the following conditions:

  • luminosity (from the sensor) bellow 400lm
  • no one at home
  • being after 4:30pm
  • I also wants to include a external temperature check and when it start decreasing

What i have already done is the code bellow, but only check the clock once (trigger), and never again returns to check the conditions.
Since at that time the sensor is above 400lm it dont start.

How can i get this automation on loop after the 4:30pm, and cheking the conditionuntil they are true?

How can i also check when the temperature start decreasing?

- id: 'xxxxxxxxxxx'
  alias: PERSIANAS | Close (winter)
  description: Close roller blind during winter when sun is going away and external temperature starts to decrease
  trigger:
  - platform: time_pattern
    hours: '16'
    minutes: '30'
    seconds: '00'
  condition:
  - condition: state
    entity_id: person.J1
    state: not home
  - condition: state
    entity_id: person.S1
    state: not home
  - condition: numeric_state
    entity_id: sensor.illumination_7811dcded1ae
    below: '400'
  action:
  - service: cover.set_cover_position
    target:
      entity_id:
      - cover.persiana_quarto1
      - cover.persiana_quarto2
      - cover.persiana_quarto3
      - cover.persiana_quarto4
      - cover.persiana_sala1
      - cover.persiana_sala2
    data:
      position: 0
  mode: single

I would change the trigger to the illumination sensor, and make the time a condition:

trigger:
- platform: numeric_state
  entity_id: sensor.illumination_7811dcded1ae
  below: '400'
condition:
- condition: time
  after: "16:30:00"

Or, you could still make the time a condition, and make a trigger that fires every x minute:

  trigger:
    - platform: time
      minutes: '/5'
      seconds: '00'

As for the temperature decreasing, maybe you could use this:

Thanks for the support.

As i can see the automation only trigger once, and if the conditions are not validated at the time it will not check again.
And what i need is if the trigger is activated, and the conditions are not validated at the time, it will call it again until it get validated.

I think you need to use a Wait Template then:

You can define a time pattern, so automation is triggered every 5 minutes, and then conditions are checked. I think this could be the best approach:

  trigger:
    - platform: time_pattern
      minutes: "/5"

Other option is to set several triggers.
The automation will start when ANY of the triggers take place.
In example:

  • a person leave the house
  • illuminance goes below 400
  • it’s 16:30 (consider using a sunset time instead, i.e. sunset with -1:30m offset. Other option is based on Sun elevation value)

Keeping the automation running and checking the conditions again and again and again… is not a good practise.

I have the automation as bellow.
If i trigger it manually it works.
But wont work automatically.

Why? Does someone can help me out?

- id: '12312312321'
  alias: PERSIANAS | Fechar (Inverno)
  description: Fechar persianas durante o inverno quando sem sol e temperatura exterior
    a reduzir
  trigger:
  - platform: time_pattern
    minutes: /5
  condition:
  - condition: state
    entity_id: person.j1
    state: '''not home'''
  - condition: state
    entity_id: person.s1
    state: '''not home'''
  - condition: numeric_state
    entity_id: sensor.illumination_7811dcded1ae
    below: '400'
  - condition: time
    after: '16:30'
  action:
  - service: cover.set_cover_position
    target:
      entity_id:
      - cover.persiana_quarto1
      - cover.persiana_quarto2
      - cover.persiana_quarto3
      - cover.persiana_quarto4
      - cover.persiana_sala2
      - cover.persiana_sala1
    data:
      position: 0
  - service: notify.notify_group_admin
    data:
      title: PERSIANAS
      data: Status | Accionadas A FECHAR | {{ as_timestamp (now()) | timestamp_custom("%T%d/%b/%Y")
        }}
  mode: single

anyone can help me out?

I think you missed the ("") and they are needed:

trigger:
    - platform: time_pattern
      minutes: "/5"

Not sure…

Hello.

Actually i found what is not working and is the verification is people are at home, the condition is always false.
I have used not_home and away and dont work.
How can this be verified using device tracker?