Xiaomi motion sensor illumination condition ignored

Hello. I have a simple automation to switch on xiaomi gateway light when movement detected (by xiaomi aqara motion sensor) if lux level is below 1 (of the same xiaomi aqara motion sensor), but it seems to be ignored. What do you think the problem is? Thanks.

condition:
 condition: numeric_state
 entity_id: sensor.ms1_lux
 below: 1

The indenting is incorrect. See the following example for correct indenting:

Thanks, but it might something else?
I followed this guide, and according to the “numeric state condition” section, my code should be ok:

Anyway, I changed indenting to this:

condition:
 - condition: numeric_state
   entity_id: sensor.ms1_lux
   below: 1

But it is still ignored. Any other tips?

Your revised version still lacks correct indentation.

The hyphen should be indented by two spaces (with respect to the word condition in the previous line), like this:

  condition:
    - condition: numeric_state
      entity_id: sensor.ms1_lux
      below: 1

It is highly recommended to execute the Check Config command after editing configuration.yaml to find formatting errors. Otherwise, upon startup, Home Assistant will ignore improperly formatted YAML code (worst case, it will fail to restart).

OK, thanks. I’ll try this and report back. FYI, I always check config (from GUI) before restart server, but it didn’t complain with neither versions.

If it still doesn’t work then it might be helpful to post the entire automation code for examination.

Unfortunately it still gets ignored… :frowning:
The full code (is it only me, or the “</>” button does not work either…?)

- alias: Éjjeli lámpa
  trigger:
    - platform: state
      entity_id: binary_sensor.ms1
      to: 'on'
  condition:
    - condition: numeric_state
      entity_id: sensor.ms1_lux
      below: 1
  action:
    service: light.turn_on
    entity_id: light.gateway_light

If you remove the entire condition section, does the automation work? In other words, if ms1 changes state to on, is gateway_light turned on?

  • If it works, then we need to look more closely at the condition section.
  • If it doesn’t work, then we have a more fundamental problem to solve.

Thanks for your help. I commented out the condition section. The automation still works exactly the same way… Seems like it doesn’t matter if the condition section is there or not…