Light doesn't turn off after no motion is detected

I have IKEA motion sensor and IKEA light bulb.
They are connected to HA via zigbee2mqtt.
They work fine 90% of the time.
But sometimes the light doesn’t turn off.

In HA

  • the motion sensor is: Clear
  • the automation is triggered
  • the action to turn off the light is triggered
  • the toggle in HA for the light is off
    but the light is still ON.

I have 3 automations:
1 for full brightness trough the day,
1 for minimum brightness trough the night,
1 to turn off the light when no motion is detected

- id: '1562703219505'
  alias: Entrance - Light off when no Motion for 1min
  trigger:
  - entity_id: binary_sensor.motion_sensor
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data:
      entity_id: light.entrance_light
    service: light.turn_off

- id: '1562706887884'
  alias: Entrance - Motion after 05:00
  trigger:
  - entity_id: binary_sensor.motion_sensor
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: 05:00
    before: '22:30'
    condition: time
  action:
  - data:
      brightness: 255
      entity_id: light.entrance_light
    service: light.turn_on

- id: '1562707484935'
  alias: Entrance - Motion after 22:30
  trigger:
  - entity_id: binary_sensor.motion_sensor
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: '22:30'
    before: 05:00
    condition: time
  action:
  - data:
      brightness: 5
      entity_id: light.entrance_light
      transition: 1
    service: light.turn_on

Can it be an issue with the Zigbee network? Maybe the off command is not reaching the light bulb and thus it is not turning off.

Have you turned on the debugging for the zigbe2mqtt addon and checked what you see there. If it is working 90% of the time I don’t think its an automation error.