Sonoff binary sensor

Recently i have change from Ewelink integration to Sonoff LAN integration. It works well when i use Ewelink integration, but now it doesn’t work.
Is it because no ‘state’ attribute in the sonoff binary sensor, it cannot trigger ?

alias: Living hall door closed - Center car porch - Decrease brightness
description: ''
  - platform: state
    entity_id: binary_sensor.sonoff_a4b00034ac
    to: 'off'
  - condition: time
    after: '19:30:00'
    before: '07:00:00'
  - service: script.dark_orange_color
mode: single

Can you check if the state changes? The state trigger only triggers when it is FALSE and changes to TRUE.

In your case, at the beginning it must be on then changes to off for the the automation to be triggered.

The automation will not trigger if since the beginning the state is already off.