Why is my motion sensor not triggering my automation

I have a Samjin Motion sensor set up through zigbee. And four Kasa outlets in my garage. The outlets work just fine from my dashboard and come on when the door break triggers. They problem I’m having is I have an automation set up with the samjin Motion sensor so that when the motion sensor does not sense motion for two minutes the plugs are suppose to turn off. This never happens, I have even tried to change the motion sensor to my ring camera that is my garage, but nothing seems to work, do I have some thing set wrong?


No trigger, no automation… :wink:

You only have conditions and actions, but no trigger…

Please do not use screenshots, but post yaml…
https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371/4

What is your automation’s trigger? The screenshot only shows its Conditions and Actions.

Post the entire automation in YAML format.

Reference: Format it properly

We don’t know that, as we can’t see the whole code :thinking:

Here is the code


alias: Garage off
description: ""
trigger:
  - type: no_motion
    platform: device
    device_id: 6d69896fb68b0b59d9751a4c8f8f44eb
    entity_id: binary_sensor.garage_motion_sensor_iaszone
    domain: binary_sensor
condition:
  - type: is_no_motion
    condition: device
    device_id: 6d69896fb68b0b59d9751a4c8f8f44eb
    entity_id: binary_sensor.garage_motion_sensor_iaszone
    domain: binary_sensor
    for:
      hours: 0
      minutes: 2
      seconds: 0
action:
  - type: turn_off
    device_id: e515337a11d4aaec0ecbb7841a53bc41
    entity_id: switch.workbench_1
    domain: switch
  - type: turn_off
    device_id: e515337a11d4aaec0ecbb7841a53bc41
    entity_id: switch.workbench_2
    domain: switch
  - type: turn_off
    device_id: 9d60cc7c302a928d6b44a8a21d36380d
    entity_id: switch.garage_corner_light
    domain: switch
  - type: turn_off
    device_id: 9eeb66c355b1cd224ace95035b8699a1
    entity_id: switch.garage_ceiling
    domain: switch
mode: single

The reason why your automation is not working is because of TIMING. When your motion detector stops detecting motion it immediately checks to see if it has been 2 minutes since it stopped detecting motion which it hasn’t. So it will never work. You need to use the STATE trigger.

platform: state
entity_id:
  - binary_sensor.garage_motion_sensor_iaszone
to: "off"
for:
  hours: 0
  minutes: 2
  seconds: 0

1 Like

Ok that worked , however sometimes I will open the door and the lights come on, but i don’t go into the garage for the motion sensor to detect me. The the “state” function only lets me set a from or a to. How do I get the automation to work with “is off for 5 min”,

There really an option for ‘does not detect motion for 5 min”

To get the automation to work with “is off for 5 min”, you would just use the STATE in the condition section of your automation. When the automation evaluates the condition it will check to make sure the motion detector has not detected motion for at least 5 minutes then execute the actions.

1 Like