Automation Condition not working

Hi Every one :slight_smile:

I trying to set a condition for a automation but the action is always executed I think the condition is always “true”.

So i have a automation to open my shutters 3 hours after sunrise but i want the condition that only execute if the Slider that have the opening % == 0.

Maybe someone can give a hand on this :):grin:

My code:

cover:
    - platform: template
      covers:
        persiana1:
          friendly_name: "Persiana"
          position_template: '{{ states.input_number.aberturapersiana1.state }}'
          open_cover:
            - service: mqtt.publish
              data:
                topic: 'cmnd/Estores1/POWER1'
                payload: 'ON'
          close_cover:
            - service: mqtt.publish
              data:
                topic: 'cmnd/Estores1/POWER2'
                payload: 'ON'
          stop_cover:
            - service: mqtt.publish
              data:
                topic: 'cmnd/Estores1/Backlog'
                payload: 'POWER1 OFF; POWER2 OFF'

input_number:
  aberturapersiana1:
    name: Abertura
    min: 0
    max: 100
    step: 1
    unit_of_measurement: '%'
    icon: mdi:blinds
  aberturapersianaold0:
    name: valor antigo de abertura
    min: 0
    max: 100
    step: 1
    unit_of_measurement: '%'

Automation:
  - id: Abrir Estores1
    alias: Abrir Estores1
    trigger:
      platform: sun
      event: sunrise
      offset: "+03:01:00"
    condition:
      - condition: template
        value_template: '{{ states.input_number.aberturapersiana1.state | int  < 0 }}'
    action:
      service: cover.open_cover
      data:
        entity_id:
          - cover.persiana1

yes your condition won’t work as input_number is defined between 0 and 100 yet your condition looks for less than 0
you need to change it this way:

      - condition: template
        value_template: '{{ states.input_number.aberturapersiana1.state | int  == 0 }}'