AutomationTrigger does not work

Hi,
I want to haven an automation for my cover when it is sunny outside. Actually it should be straight foreward, but sometimes it triggers and sometimes it does not. I use the scn-ws3hw.01weather station which is connected to my KNX-BUS-System. I simplified the automation for this entry. The first one is to shut the cover, and the second one should open it again.

alias: Test
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.dach_helligkeitssensor_sued
    above: '10000'
    for: '0:1:00'
condition:
  - condition: state
    entity_id: input_boolean.test_unten
    state: 'off'
action:
  - service: cover.set_cover_position
    data:
      position: 90
    entity_id: cover.eg_kueche_rolladen
  - service: input_boolean.turn_on
    data: {}
    entity_id: input_boolean.test_unten
mode: single
alias: test hoch
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.dach_helligkeitssensor_sued
    below: '100000'
    for: '0:1:00'
condition:
  - condition: state
    entity_id: input_boolean.test_unten
    state: 'on'
action:
  - service: cover.open_cover
    data: {}
    entity_id: cover.eg_kueche_rolladen
  - service: input_boolean.turn_off
    data: {}
    entity_id: input_boolean.test_unten
mode: single

I tried like every combination for the ‘for’ statement. Like I said, sometimes it triggers after 3 minutes, sometimes after 3 hours and in other cases 3 days, but never after the set time. In my real automation I have the sunset as second trigger to open the cover again. This trigger always works, but actually it should have been opened hours before. Please help me!
Thanks in advance
Kevin

This needs to be in this format. Did you try this format?

for: '00:01:00'

yes sure, but thanks.
if I write

for:
  minutes: 1

home assistant automatically changes it to your format.
I justed tried something with the missing zero :smiley:

I have combined the two automations in one. Please try this and let me know if there are any issues.

alias: Cover Position Automation
description: ''
mode: single
trigger:
  - platform: state
    entity_id: sensor.dach_helligkeitssensor_sued
    for: '00:01:00'
condition: []
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: input_boolean.test_unten
                state: 'off'
              - condition: template
                value_template: >-
                  {{ states('sensor.dach_helligkeitssensor_sued')| int > 10000 }}
        sequence:
          - service: cover.set_cover_position
            data:
              position: 90
            entity_id: cover.eg_kueche_rolladen
          - service: input_boolean.turn_on
            data: {}
            entity_id: input_boolean.test_unten
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: input_boolean.test_unten
                for: 'on'
              - condition: template
                value_template: >-
                  {{ states('sensor.dach_helligkeitssensor_sued')| int <= 10000 }}
        sequence:
          - service: cover.open_cover
            data: {}
            entity_id: cover.eg_kueche_rolladen
          - service: input_boolean.turn_off
            data: {}
            entity_id: input_boolean.test_unten
    default: []

Another thing is that your triggers are overlapping:

trigger:
  - platform: numeric_state
    entity_id: sensor.dach_helligkeitssensor_sued
    above: '10000'
    for: '0:1:00'
trigger:
  - platform: numeric_state
    entity_id: sensor.dach_helligkeitssensor_sued
    below: '100000'
    for: '0:1:00'

you close the cover at above 10000 (four zeros) and want it to open again below 100000 (five zero’s). I doubt that will work like you expect.

Unless you do… :man_shrugging:

Thanks a lot! That works fine for the test automation. You made my day. Now I have one more question, if the cover should shut down after 1 minute, but should open after 5 minutes. How would this look like? I solved it with a delay of 4 Minutes. Do you have a better option or is it fine like that? It works so far. Thanks in advance!

alias: Cover Position Automation
description: ''
trigger:
  - platform: state
    entity_id: sensor.dach_helligkeitssensor_sued
    for: '00:00:20'
condition: []
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: input_boolean.test_unten
                state: 'off'
              - condition: template
                value_template: >-
                  {{ states('sensor.dach_helligkeitssensor_sued')| int > 10000
                  }}
        sequence:
          - service: cover.set_cover_position
            data:
              position: 90
            entity_id: cover.eg_kueche_rolladen
          - service: input_boolean.turn_on
            data: {}
            entity_id: input_boolean.test_unten
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: input_boolean.test_unten
                state: 'on'
              - condition: template
                value_template: >-
                  {{ states('sensor.dach_helligkeitssensor_sued')| int <= 100000
                  }}
        sequence:
          - delay:
              hours: 0
              minutes: 3
              seconds: 0
              milliseconds: 0
          - service: cover.open_cover
            data: {}
            entity_id: cover.eg_kueche_rolladen
          - service: input_boolean.turn_off
            data: {}
            entity_id: input_boolean.test_unten
    default: []
mode: single

Yeah i wanted the test automation to go down and up in a minute interval. But it was stupid of me in this way. You are right, the triggers corrupted each other. Thank you!

If you are not waiting for any trigger to open the cover after it closes, then the delay is the best choice.

I have noticed that the cover will open even if the value drops under the new value for a short time (like 1 minute). Actually the value should be below this value for a given time (like 10 minutes). Do you have a clue how to bring in a ‘for’ statement or a second trigger?

I have set this at 1 minute. we need to change it to for: '00:10:00'

Okay, that would change both times to 10 minutes. I mean that it should close after 1 Minute, but opens after 10 Minutes.
Thank you for answering my stupid questions!

1 Like

In that case we have to split the automation into two and it will look like the one you have first posted. It should work but for me numeric state trigger has had its own share of inconsistencies. You can try to perfect it.

Always happy to help… :grinning:

1 Like