Binary sensor to work as "occupied"

Hi guys, I need some help :slight_smile: I have a hedgehog house with two hedgehogs that are getting ready for a cold Norwegian winter. To make sure they are OK, I have installed an ESP8266 (running ESPHome) with a motion detector and a Dallas temperature probe. Heres the problem: Every time they move inside the house, the motion detector gets active for 2 seconds, and then turns off. I want to use that 2 second on/off as an input to a “occupied” sensor, so that when binary_sensor.hedgehog_house is activated, it will show as occupied for 10 minutes. I’m thinking maybe a template sensor is the correct solution here, but I really don’t understand where to begin. Can someone help me?

There is this automation blueprint:

You could use a template binary_sensor with the auto_off feature:

Something like this ?

template:
  - trigger:
      platform: state
      entity_id: binary_sensor.hedgehog_house
      to: "on"
    binary_sensor:
      - name: Hedgehog House Occupied
        auto_off: 600
        state: "true"

Or you could use the delayed off in ESPHOME (probably easier)

That seems to work, thank you! :smiley:

Is there any way to make the sensor say something else than on/off, maybe clear/occupied?

You can add device_class to the config

maybe device_class: occupancy

Fantastic, you made my day! Thank you! :smiley: