Shutter close sensor control

I created an automation to override shutter down when the sensor is open.
It works when I open the sensor.
But when the sensor is open the shutter still going down.
How can I solve this problem?

’ ’ ’
alias: New Automation
description: ‘’
trigger:

  • type: opened
    platform: device
    device_id: 52b99d8f072a2249a59d6db43f4006d5
    entity_id: binary_sensor.openclose_2
    domain: binary_sensor
    condition:
  • type: is_open
    condition: device
    device_id: 52b99d8f072a2249a59d6db43f4006d5
    entity_id: binary_sensor.openclose_2
    domain: binary_sensor
    action:
  • device_id: de945ca2bfdf1313a3d98554f3b27b53
    domain: cover
    entity_id: cover.roller_shutter_2_2
    type: set_position
    mode: single
    ’ ’ ’

Hello and welcome to the forum. Please edit your post and format your pasted code as per point 11 here.

It appears you have attempted this but are using three single quotes ‘’’ instead of three backticks ```.