Binary sensor / keep on until x sec with no movement


I try to keep my sensor on “Detected” until no movement has been detected for x seconds.

  - platform: mqtt
    name: "Einfahrt Motion"
    device_class: motion
    state_topic: ai/Aussen_sd/motion
    payload_on: "on"
    payload_off: "cancle"
    value_template: "{{value_json.state}}"
    off_delay: 20

the off_delay comand always turns off after 20 seconds. Even if there was movement in the meantime.

Are you sure the command the motion sensor sends to indicate off is cancle?


But it works now… deleted the “payload_off: “cancle”” line…

That was going to be my suggestion because is you are using off_delay that’s for device’s that only report when they are on but not when they are off.

If the device reports its on and off states but use different values from on/off then you specify what they are with payload_on and payload_off. In your case, you don’t need to specify either of them because on is the default and your device doesn’t send anything to report its off state.

1 Like