Motion detection does not trigger fast enough

I have two motion detectors but when i enter any of the places where they are it can take up to some minutes before my lights turns on.

Is there a way to make it faster?

Here is my automation:
automation:

  • alias: ‘Light hallway if motion 2’
    trigger:
    • platform: state
      entity_id: switch.net_hallsensor
      to: ‘on’
      condition:
    • condition: state
      entity_id: input_select.status_hemma
      state: ‘Hemma’
      action:
    • service: script.turn_on
      entity_id: script.motion_detection

My script:
script:
motion_detection:
sequence:
- service: homeassistant.turn_on
data:
entity_id: switch.hall_entre
- service: homeassistant.turn_on
data:
entity_id: switch.hall_golvlampa
- service: homeassistant.turn_on
data:
entity_id: switch.hall_kladhangare
- delay: 00:05:00
- service: homeassistant.turn_off
data:
entity_id: switch.hall_entre
- service: homeassistant.turn_off
data:
entity_id: switch.hall_golvlampa
- service: homeassistant.turn_off
data:
entity_id: switch.hall_kladhangare

And my sensors:

Fibaro model FGMS-001
image

Telldus model 312685
image

You could try to call service “switch.turn_on” instead of “homeassistant.turn_on” to see if it makes any difference.

Also if you activate the script manually, do the switches turn on immediately?

1 Like

Seems like it was a bit faster now :slight_smile:

I’ve never had a good experience with turning on lights using motion sensors because of the slow response. Even a few seconds to me is too long.

True :frowning:

Well that’s unfortunate! I would think that’d be a main reason to get a motion sensor. I bought a couple and haven’t hooked them up yet. I really hope it doesn’t take minutes to turn the lights on, that would be idiotic.

Do you a System monitor sensor setup? Could you look at load sensors?

Try to make a group to turn several switch on at once, it will be much faster than the sequence.
Also you should try to use timers to handle the turn off sequence, it will also allow you to keep the light on if there is still some movement.

Here it’s what it would look like:

automation:
  - alias: Light hallway if motion 2
    trigger:
      - platform: state
        entity_id: switch.net_hallsensor
        to: 'on'
    condition: state
      entity_id: input_select.status_hallway
      state: 'Hemma'
    action:
      - service: timer.start
        entity_id: timer.timer_hallway
      - service: switch.turn_on
        entity_id: group.hallway_light
  - alias: Turn off hallway lights at end of timer
    trigger:
      - platform: event
        event_type: timer.finished
        event_data:
          entity_id: timer.timer_hallway
    action:
      service: switch.turn_off
      entity_id: group.hallway_light

timer:
  timer_hallway:
    duration: '00:03:00'

group:
  hallway_light:
  name: "Hallway light"
  entities:
    - switch.hall_entre
    - switch.hall_golvlampa
    - switch.hall_kladhangare

That will turn them on for 3 minutes, and restart the 3 minutes delay every time a new movement is detected.

I use it with some 433MHz movement sensor and a DYI bridge (433MHz to mqtt), and that turn ON the light in about 1 second.

Also make sure the fibaro is setup correctly, per default the Fibaro only report movement after 2 detection (pulse counter).

4 Likes

Don’t worry, it really shouldn’t, something is wrong with the sensor or setup if it take more than 1-2 seconds.

Thank you all, @touliloup your solution was the best

1 Like

Just for your reference, here is my turn on/off motion light in one automation.

automation kitchen_light_movement:
  alias: Turn on off kitchen lights when there is movement
  trigger:
    - platform: state
      entity_id: binary_sensor.Family_Room_Motion
      to: 'on'
    - platform: state
      entity_id: binary_sensor.Family_Room_Motion
      to: 'off'
      for:
        minutes: 10
  action:
    - service_template: '{% if trigger.to_state.state == "on" %}homeassistant.turn_on{% elif trigger.to_state.state == "off" %}homeassistant.turn_off{% endif %}'
      entity_id: light.kitchen_light

@RobDYI thanks for the AIO method, ive been looking for a way to clean this up.
Question for you though, how do you handle turning off the lights if they were turned on by means other than motion.

If I understand the way the trigger works correctly, its only going to turn them off when the state of the motion sensor changes to off (for 10 mins). So if there is already no motion and the lights are turned on by a scene change, a grouped switch, or a meddling childs fingers, then the state will never change to off to trigger the automation, because it has been in off the whole time.

One solution is to put an input_boolean to the automation or script and a timer connected to that.

Here is another solution that i am using for my coffee :slight_smile:

- alias: 'Stäng av perkulator 35 minuter efter start'
  initial_state: true
  trigger:
  - platform: state
    entity_id: switch.net_perkulator
    from: 'off'
    to: 'on'
  action:
  - delay: 00:35:00
  - service: homeassistant.turn_off
    entity_id: 
    - switch.perkulator

Thanks @dawnlord
So basically I need to create a fake switch for every switch/group tied to a motion automation?

Could I just use the light/switch/group state as a trigger?
Would I need to add a condition for motion=no to prevent conflicts with the normal timer? Or would setting it to a higher delay count than the normal timer do the trick.

So if this is my normal motion sensor on/off automation

  alias: Turn on off family room lights when there is movement
  trigger:
    - platform: state
      entity_id: binary_sensor.Family_Room_Motion
      to: 'on'
    - platform: state
      entity_id: binary_sensor.Family_Room_Motion
      to: 'off'
      for:
        minutes: 10
  action:
    - service_template: '{% if trigger.to_state.state == "on" %}homeassistant.turn_on{% elif trigger.to_state.state == "off" %}homeassistant.turn_off{% endif %}'
      entity_id: group.family_room

I assume this would work as a failover without causing any conflicts

  alias: Failover family room lights off
  trigger:
    - platform: state
      entity_id: group.family_room
      to: 'on'
      for:
        minutes: 15
  condition: state
      entity_id: binary_sensor.Family_Room_Motion
      state: 'off'
  action: homeassistant.turn_off
      entity_id: group.family_room

I think this was a great solution.
Then you can also have timers visible in frontend and see the countdown.

I will probably replace my coffee automation with timer instead.

Thanks for your script. I made it event shorter on the action section and it works

automation kitchen_light_movement:
  alias: Turn on off kitchen lights when there is movement
  trigger:
    - platform: state
      entity_id: binary_sensor.Family_Room_Motion
      to: 'on'
    - platform: state
      entity_id: binary_sensor.Family_Room_Motion
      to: 'off'
      for:
        minutes: 10
  action:
    - service_template: 'light.turn_{{trigger.to_state.state}}'
      entity_id: light.kitchen_light

Of course, how did I not see that, thanks.