Trigger automation every minute - Move Cover when AC on

Hi,

I am struggling with an automation that should do the following:

I have an A/C that is attached to a Shelly Power Switch, which also monitors the power usage. The AC is a mobile AC which requires the window to be open and the cover blinds ideally at specific position that there is enough room the air can flow out.

It could now happen that someone in the house closes the curtain while the AC is on. This would cause that the hot air blows against the closed cover blind and the room will become hotter instead of cooler.

I would like to have an automation which checks every minute if the covers are at a certain position. If not… an action will be triggered to move the cover to that position.

I used the following code… but it doesn’t work :frowning:

alias: Paul A/C check window position every min
description: ""
trigger:
  - platform: time_pattern
    minutes: /1
condition:
  - condition: and
    conditions:
      - condition: numeric_state
        entity_id: cover.og_paul_l_l
        attribute: current_position
        above: 33
      - condition: numeric_state
        entity_id: cover.og_paul_l_l
        below: 31
action:
  - data:
      position: 32
    target:
      device_id: 0157b3ce10d5165d14e4f9b7e9d1ad5a
    action: cover.set_cover_position
mode: single

I would be thankful for any help here.

instead of triggering all the time then you should consider triggering on cover not being 32, or AC turning on (if possible).

description: ""
mode: single
trigger:
    - platform: state
      entity_id: cover.og_paul_l_l
      not_to: 32
    - platform: state
      entity_id: sensor.AC
      to: "ON"
condition: 
  - condition: state
    entity_id: sensor.AC
    state: "ON"
action: 
  - data:
      position: 32
    target:
      device_id: 0157b3ce10d5165d14e4f9b7e9d1ad5a
    action: cover.set_cover_position

But if you only want to fix your automation then the issue is the and.
The cover position can’t be both below 31 and above 33 at the same time.
Just change the and to or and it should work

1 Like