Automation not working can you give me some help?

hello, i’m a begginer with HA, i make some automation who’s work but this one doesn’t want to work.
can you help me ?

  • alias: ‘OuvertureDadou’

    trigger:

    - platform: state
    
      entity_id: binary_sensor.fibaro_system_fgms001_motion_sensor_sensor
    
      from: 'off'
    
      to: 'on'
    

    condition:

      condition: and
    
      conditions:
    
       - condition: state
    
         entity_id: cover.fibaro_system_fgrm222_roller_shutter_controller_2_level_5
    
         state: close
    
       - condition: state
    
         entity_id: binary_sensor.fibaro_system_fgms001_motion_sensor_sensor
    
         state: 'On'
    
       - condition: time
    
         after: '05:00:00'
    
         before: '07:30:00'
    

    action:

    • service: cover.set_cover_position

      data:

      entity_id: cover.fibaro_system_fgrm222_roller_shutter_controller_2_level_5

      position: 30

thanks for your help

You have the same entity in the trigger and the condition… If the trigger is validated this means that the entity binary_sensor.fibaro_system_fgms001_motion_sensor_sensor is “on”. Try to remove it in the condition and adapt the identation as follow (I made some changes, remove quotes in alias, added quotes in state: ‘close’… :

- alias: ouverturedadou
  trigger:
    - platform: state
      entity_id: binary_sensor.fibaro_system_fgms001_motion_sensor_sensor
      from: 'off'
      to: 'on'
  condition:
     condition: and
     conditions:
       - condition: state
         entity_id: cover.fibaro_system_fgrm222_roller_shutter_controller_2_level_5
         state: 'close'
       - condition: time
         after: '05:00:00'
         before: '07:30:00'
  action:
     - service: cover.set_cover_position
       data:
          entity_id: cover.fibaro_system_fgrm222_roller_shutter_controller_2_level_5
          position: 30

thanks for your help, i past this on my config i will test tomorow :smiley:

Please also read this and format your code correctly. Please be informed that on and off are normally lowercase, you can see the actual state if you go to Developer Tools -> States. Are you sure that the state of cover.fibaro_system_fgrm222_roller_shutter_controller_2_level_5is close and not closed, off or something else?