Need help with automating Homematic cover positions

I have a homeatic ip cover button for my kitchen cover.
I would like my kitchen cover to
(1) set a position to 50, when I press the “down” button (in the app or the switch on the wall).
(2) When the cover is at position 50 and I press the button once again, I would like it to go to position 0 (closing).

I tried to automate (1) in a first step. However, my automization is not triggered, when I press the down button. Here is my code:

alias: kitchen cover automization
description: ""
trigger:
  - platform: device
    device_id: 5790...d0a9
    domain: cover
    entity_id: b21f...ac71
    type: closing
condition: []
action:
  - device_id: 5790...d0a9
    domain: cover
    entity_id: b21f...ac71
    type: set_position
    position: 50
mode: single

Any idea, what I did wrong?

When you say “button”, do you mean a button?

device_Id is best avoided if possible.

1 Like

Sorry, with button I meant the switch on the wall in the kitchen and this thing in the home assistant app:

Both dont trigger my automatization.

@Stiltjack:
What is the alternative to the device_id?

Well… It looks as if the entity triggering the automation is the same as the entity in the action section - so when it starts to perform one action, you want it to do something different. Not sure that’s even possible.

Shouldn’t the trigger be something else? The button press? The action could then be…

If… position is 50… close completely
Else… close to 50

In the trigger, almost always the state or numeric state of an entity, then call a service in the action section.

trigger:
  - platform: state
    entity_id:
      - switch.bedroom_socket_1
    to: "on"
condition: []
action:
  - service: light.turn_on
    data: {}
    target:
      entity_id: light.bedroom

I changed my code and used the state keyword, but the automatization is still not triggered:

alias: Küche Rollladen
description: ""
trigger:
  - platform: state
    entity_id:
      - cover.homeatic_ip_access_point_rollladen_kuche
    to: closing
condition: []
action:
  - device_id: 5790fe........c7d0a9
    domain: cover
    entity_id: cover.homeatic_ip_access_point_rollladen_kuche
    type: set_position
    position: 50
mode: single