Faster delay off for a PIR sensor?

Hi all!

I have a PIR sensor which triggers to “clear” after 5 seconds, even if I change the “delayed_off” filter to 0 seconds. Any idea how to make the sensor go “clear” after 2 seconds?

Thank you in advance!

Sounds like it is a limitation of your PIR hardware. Do you have a manual or datasheet for it?

I have a professional ‘alarm’ type PIR and the detected period is hard coded. I also have a ali-express DIY type motion PIR with a potentiometer which controls the detected period; but I think the minimum is still 5 seconds. I also have a IR beam type detector; it is on only as long as something breaks the beam. All different!

It’s an Athom ESP Presence sensor, I don’t know exactly what PIR is using, but yes… if there is such a limitation, it should have this as well… :frowning:

I believe the answer is quite simple. The delay is set in the YAML.

If you have bought it preflashed, then you can reflash by way of the web page interface.

And the somebody has posted the yaml here:

And if you go to the following in the code you can alter the timing:

  - platform: gpio
    pin:
      number: GPIO14
      mode:
        input: true
        pullup: true
    name: "Pir Sensor"
    id: pir
    filters:
      - delayed_on: 50ms
      - delayed_off: 10s
    device_class: motion
    on_press:
      then:
        - light.turn_on: led

This is only a quick google …so you need to check yourself that you understand the code and what you are doing…

@PickOne You got me interested. There is already a thread on this device with a lot of discussion and latest yaml. I might buy one… I need something for my garage for occupancy…

I am already using that yaml, even customized for filling my own needs, but if you set the delayed_off to 0, it will still have 5 seconds delay, like a hardware limitation, as Tom said… :expressionless:

The device is quite good, and very well made, you can see the quality from the first momen you unbox it

These no other yaml code for this device, it is just the one from the athom, posted in more website (i think), but it is the same. It can be customized and used only locally, without github, but stil, this does not solve the delay pir off… :frowning:

Is that because of the microwave? I will get one and play around. Anything is possible.

In ESPHome you can use the automations commands which include the command “on_click”. So for example you can use the “copy” platform to create another sensor which allows a command to be sent “on_click”. You can then run an automation instantly. I suspect this would be very easy to achieve. Let me go and order.

I don’t think that the microwave has anything to do with the pir…

I don’t know how to program into ESPHome, if you have any idea how to get the PIR go clear after 2 seconds, don’t hesitate to share it with us :smiley:

@PickOne

on_press
This automation will be triggered when the button is first pressed down, or in other words on the leading edge of the signal.

binary_sensor:
  - platform: gpio
    # ...
    on_press:
      then:
        - switch.turn_on: relay_1

I need to lean about this, maybe I can get it to work like I want.

By the way, if you have any problems with your device, as software “brick” and you don’t know how to revive it, don’t hesitate to ask me, I tested all the stupid and non-stupid things today, software briking the device at least 5 times :smiley: Now I know everything about this device, I just need to learn how to make that sensor which you said. Thanks

I have 5 Athom plugs all with custom ESPHome configurations … hopefully I have been around the block!

I note from other thread on this device that you might want to look at the Blackadder yaml as this has an entry to adjust for where the mmwave and PIR are locked on detect after an event.

Just checking that you have seen this thread

Edit: I have purchased two sensors… to add to my bin of sensors needing a job…

1 Like

I will wait till you get the device, maybe you can help me with the 2 seconds delay_off for the PIR sensor :frowning: I don’t understand too much how to achieve this…

I have compared the yaml from blackadder with the original… There are not so many changes and the changes are not so significantly … Beside the fact that some values are changed from 1 to 0.5 and the occupancy calculation from (and) to (or) between mmwave and pir… There is no other change which can improve the functinoality… I think the deice it is already working good

Edit: I have a question, because you have more experience with these ESPHome devices, maybe you know this better… If an ESPHome device have the web server enabled, it consumes MORE resources? So many than the product becomes warmer than it should?

Hello @PickOne …….

To answer your original question, the yaml has a setting for delayed_off


pir_delay_off: "5s" # set the PIR no occupancy delay here, it also influences delay for Occupancy sensor

I have just set up light automation, and I am using the occupancy sensor, as there are long periods of time where I am working at my bench. So far so good.

Apparently, as I understand it uses up memory……. So only relevant if you are getting errors on trying to compile to an ESP node which has small memory. Otherwise who cares …… these devices are so small…… I have one device which is doing thousands of calculations per second……I tend to offload as much computing to ESP nodes as possible.