Mqtt sensor to turn light on

Hi everybody,
I’m quite new using HA and I’m facing a problem. I’m trying to turn on my bedroom light when the door sensor detect it, but not working at all.
Here is my script :

Blockquote

  • alias: Turn on bedroom Light When Doors Open
    hide_entity: false
    initial_state: ‘on’
    trigger:
    platform: mqtt
    topic: /Sonoff/rfb/dw1/
    payload: “off”
    condition:
    condition: time
    after: ‘17:00:00’
    before: ‘23:59:00’
    action:
    service: switch.turn_on
    entity_id: switch.lumiere_bed

Blockquote

If someone could help me please.

Solved. I used platform : state instead.

Hi Valert_Helenon

Could you elaborate on how you setup the DW1 Switch to work with home assistant ? Do you use Sonoff RF Bridge?

I have Sonoff RF Bridge Flashed with Tasmota . I Learned RFKEY6 and it works when I open the DW1 (I can see it in the console) but I don’t have an idea how to continue from there to implement it into Home assistant.

i would appreciate any help.

Thank you