Setting motion sensor to inactive

Does anyone know how to send an inactive command to a motion sensor from a smartapp? What would the exact syntax be?

Thanks!

What are you trying to do with it? Are you trying to get it to reset quicker? The newer ST motion sensors reset after about 12 seconds I think.

I’m trying to reap orphaned motion sensors. What seems to happen is the sensor will send an “inactive” back to the Hub, but the Hub either doesn’t pick it up or ST is offline. The simple solution for me is to have an app that modifies the device as inactive after 5 minutes or so.

I have the rest of the code accomplished, now I am trying to wrap up setting the attribute / issueing the command. Any insight?

1 Like

No. Not insight on that. I haven’t seen any of the motion sensors that you can send commands to or change the status. It is interesting, if you are able to figure it out make sure to post for sure.

I’m pretty sure I’ll have to make a custom device to support it. I was trying to avoid that but it looks like its necessary

1 Like

Which motion sensor are you talking about? Do you have the technical command specification?

I am not aware of the ability to send a command to the motion sensor to reset it.

If the motion sensor sends an inactive event to ST, you may have to change the device type handler.

There are motion sensors who send a motion detected event, but never send a motion inactive event. The ST model abstracts a motion to active/inactive, so in such a case you need an helper app to generate the corresponding inactive event.

I used some Schlage/Ecolink contact sensors as pressure sensors similarly to this post.

ST picks these up correctly as contact sensors, which I modified to motion sensors. However, ST sometimes confuses the state of these sensors, and really is only useful for determining if there is pressure in a “presence” context rather than “occupancy” context. The bad news is that sometimes ST understands the sensor to have continuous motion for hours when it does not. Thus, I had a need to clear the occupancy from the sensor on a regular basis.

I solved this issue by creating a custom motion sensor device with an added “refresh” capability. This refresh clears any active motion. A Pollster-inspired SmartApp reaps the sensors on a regular basis, so that they do not remain stuck in “active” motion. The code for both the custom device and SmartApp are here:

As an additional use case, I have two low quality battery z-wave motion sensors that sometimes do not report “inactive”. This device type and SmartApp cure that issue as well.

Just be careful how often you set the interval. Reaping, like polling, generally kicks a device out of its sleep state, so you can run through batteries really fast on battery powered devices, as well as increasing energy consumption overall. (I have seen " green" automated systems use more energy than the previous nonautomated set up because polling was set for 1000 times a day or more.)

In addition, frequent interval activity can significantly increase network load which can cause multiple different problems. Devices being polled may be too busy to act as a repeater, delaying commands being passed to other devices and even effectively reducing network range. They may also cause degradation in other networks that share the same band range.

There are even some sensors that keep resetting their internal interval timer each time they’re polled. If the polling interval is less than the hardware’s detection interval, the sensor will use power but never trip, because it keeps getting reset to the start of its countdown. This varies by physical device, so it’s just another thing to be aware of.

It doesn’t mean we never poll, just understand the load you’re putting on your network in terms of both network traffic and energy consumption and set the polling frequency mindfully.

. . . . didn’t read the entire thread carefully but could you use a state variable as a proxy for the motion status? Just use a runIn or something to change it to inactive after some period of time after a motion event.

Hi JD - thanks for the feedback. I am not actually z-wave polling / refreshing the devices. Even though the SmartApp is interacting with the device code, the sensor itself has no method on the Hub or the device to handle the refresh. This is just a hack to “unstick” faulty motion.

1 Like

Aaron - definitely a good idea. I still would need a virtual device though so I went a slightly less hacky route IMO.

By the way if anyone from the ST side picks up this code, the ideal way to implement would be to improve the devices to offer the refresh capability, and then make the reaper app a “timeout” SmartApp built into the device.

Just wanted to say that I have the same problem with my Ecolink motion sensor and this resolves it. Thanks for writing this! It gets locked into an active state about once every 2 weeks or so. Very annoying. But this takes care of it.