Xiaomi gateway illumination sensor - “Solved”

What am i doing wrong?
The Gateway light isn’t turning on, i want it to turn on when the illumination is below 200.

  • alias: ‘auto_nightlight_on’
    hide_entity: True
    initial_state: True
    trigger:
    • platform: numeric_state
      entity_id: sensor.illumination_7811dc64e18a
      below: ‘200’
      condition:
      condition: and
      conditions:
    • condition: numeric_state
      entity_id: sensor.illumination_7811dc64e18a
      above: ‘300’
    • condition: state
      entity_id: light.gateway_light_7811dc64e18a
      state: ‘off’
      action:
    • service: homeassistant.turn_on
      data:
      entity_id: light.gateway_light_7811dc64e18a
      brightness: 25
      rgb_color: [175, 0, 0]
1 Like

You’re expecting the illumination value to be below 200 and above 300 at the same time. Which can never happen.

Thnx, that worked.

Please mark the topic as “Solved” to facilitate other participants in the forum

What was the end result code?

Her is my code:

- alias: 'auto_nightlight_on'  
  hide_entity: True
  initial_state: True
  trigger:
    - platform: numeric_state
      entity_id: sensor.illumination_7811dc64e18a
      below: '300'
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: light.gateway_light_7811dc64e18a 
      state: 'off'
    - condition: state
      entity_id: input_boolean.auto_nightlight
      state: 'on'
  action:
    - service: homeassistant.turn_on
      data:
        entity_id: light.gateway_light_7811dc64e18a
        brightness: 25
        rgb_color: [175, 0, 0]
- alias: 'auto_nightlight_off'  
  hide_entity: True
  initial_state: True
  trigger:
    - platform: numeric_state
      entity_id: sensor.illumination_7811dc64e18a
      above: '400'
  condition:
    condition: state
    entity_id: light.gateway_light_7811dc64e18a 
    state: 'on'
  action:
    - service: homeassistant.turn_off
      data:
        entity_id: light.gateway_light_7811dc64e18a

can you explain me why you use “input_boolean.auto_nightlight” i dont see this input in your code. I have to turn on manually, and them the “auto_nightlight_off” is working fine for me. Just dont Turn On, Thanks in advance