Motion sensor template

I have a Hue motion sensor that is connected to Home Assistant via deConz. It works flawlessly and responds with on/off. My challenge is that the sensor is sending the “off” command after 30 seconds and cannot be configured in deConz, I use it for turning on or off a hallway light, but I would like to extend the on period from 30 seconds to 60 seconds. I know I can make an automation that accounts for that, but can I make a sensor template that uses the hue motion sensor as input, but extends the on period to 60 seconds, but also only turn off if the hue motion sensor is off. The reason for this is to avoid that the sensor turns off after one minute if the hue motion sensor then is on in the meantime.

I have my motion sensor setup though the hue integration, its default on time is 10 seconds, but I use it turn the hallway lights off after 60 seconds, but I also want it so that it is 60 seconds after no movement is detected, so I just use this automation,

- id: '1528230304458'
  alias: Hallway Motion Off
  trigger:
  - entity_id: sensor.hallway_motion_motion_sensor
    from: 'on'
    platform: state
    to: 'off'
    for:
      seconds: 50
  condition: []
  action:
  - data:
      entity_id: scene.hallway_off
    service: scene.turn_on

The important bit there is the

for:
  seconds: 50

so if it detects movement in there within the 50 seconds, it restarts the timer.

Not quite sure if that is what you are after, as you said you didn’t want to do it with an automation, but I have no experience with deConz, sorry.

Thanks - I think I will end up with a solution like yours. I would just have preferred, that the motion sensor icon and text could be reflecting an on period of 60 seconds. If I do the automation path the icon would look like the sensor is off after 30 seconds, but the light will be on additional 30 seconds. I know it is nitty gritty, but it would have been consistent :slight_smile:

I think that’s just how all motion sensors work. I have the hue ones setup through the hue hub, and then through the native hue interface in HA, and they have a 10 second reset time on them before they are classed as no motion, where as the Xiaomi sensor I have has a 120 second reset time on it before it becomes clear.

That makes sense. The rest of my motion sensors are z wave and there I can define the duration before the motion is cleared. I had hoped to replicate that via a template, but I will go ahead and do it as an automation.

1 Like