Automation doesn't work with the humidity sensor

Hello everyone, I have this configuration:

 - alias: humidifier_on
   trigger:
     platform: numeric_state
     entity_id: sensor.0x00158d0002b5b761_humidity
     below: 52 
   condition:
    - condition: numeric_state
      entity_id: sensor.0x00158d0002b5b761_humidity
      below: 52  
    - condition: state
      entity_id: binary_sensor.0x00158d0003120f72_contact
      state: 'off'
   action:
     - service: switch.turn_on
       entity_id: switch.0x00158d00027cfe57_switch
##
 - alias: humidifier_off
   trigger:
     platform: numeric_state
     entity_id: sensor.0x00158d0002b5b761_humidity
     above: 60 
   action:
     - service: switch.turn_off
       entity_id: switch.0x00158d00027cfe57_switch

The “humidifier_off” automation works, then the humidity drops below 52 and the “humidifier_on” automation doesn’t work. What could be wrong?

Your humidity sensor drops below 52, and immediately after it does, you check if it drops below 52, since that doesn’t really make a ton of sense, you can just remove the first condition.
That’ll leave you with:

   trigger:
     platform: numeric_state
     entity_id: sensor.0x00158d0002b5b761_humidity
     below: 52 
   condition:
    - condition: state
      entity_id: binary_sensor.0x00158d0003120f72_contact
      state: 'off'
   action:
     - service: switch.turn_on
       entity_id: switch.0x00158d00027cfe57_switch

As for why it’s not working, seems like the binary_sensor is on or unavailable when you test it :thinking:

Thank you for your answer, how can I check what doesn’t work or isn’t available in this automation?

Set the contact sensor so that the automation should trigger, then look into the developer tools -> states and check if the binary_sensor is configured correctly, maybe you need to switch off to on or sth. similar