Xiaomi motion sensor lux

hi all,
im trying to use my xiaomi motion senser (which also has lux reading) to turn on lights when it gets darker. The sensor it self is working nicely, but i can not get the automation to work. It is working if I activate it manually, but it does never trigger automatically.

Here is my code:

  • id: ‘1553782374713’
    alias: New
    trigger:
    • below: ‘300.0’
      entity_id: sensor.lightlevel_5
      for: ‘1’
      platform: numeric_state
      condition: []
      action:
    • service: homeassistant.turn_on

Please format your code correctly. This is not readable.

OT: I think the lux sensor reports the values in string format. So a numeric_state won’t work. You’ll have to use a template platform.

Another thing to realize is the lux reading is very unreliable. You can’t really use it to turn on the light when it gets dark. If I remember correctly it also only gives you lux reading when motion is detected. Search the forum, there have been some discussion on using the sensor the way you want.