Generic Zigbee Motion Sensor driver. Can command = active/inactive be made available

I have just purchased a Tuya motion sensor and it works well using the 'Generic Zigbee Motion Sensor (no temp)'.
When using this, 'configure' and 'refresh' are available on the device page.
Would it be possible to add the capability of having 'active' and 'inactive' buttons so that access to these states is available via buttons on the device page and custom commands etc.
Many thanks for considering and I fully understand if it is a no. (Just hoping). :wink:

My understanding from someone else is that this driver also works with it. You could then add any feature you want.

1 Like

Thanks for this.
I'll have a little look and see if I can work out what to do. I cannot code but I can copy. (Poke and hope). :wink:

1 Like

Same. I’d look at some other examples that have it and then ask in the forum if you get stuck. I think it’s not too hard and I’m confident someone will help.

1 Like

I've just allocated this driver to the motion sensor and it is working.
It also shows active/inactive buttons so if it stays connected and working OK this driver should do the trick.
Thanks again.

Oops. I allocated the wrong driver. Will have another look. :blush:

Hi @mike.maxwell
Any thoughts on my request?

I don't understand why particulary...

I have had instances where a device goes active but does not always goes inactive.
This is a rare occurrence I agree but it does happen.
I have written rules to monitor my motion sensors so that if they are 'stuck' active for more than a set amount of time a custom command of 'inactive' can set motion to inactive.

Yeah, I'm not so keen on adding this to a driver simply to overcome what amounts to a probable device issue.

1 Like

I have a couple of Iris V2 Motion sensors that on occasion do this as well Takes me wondering why the lights are still on to figure it out

A workaround to this is possibly to use that custom command to use the "refresh" button selection (I think) that works at getting the device back on track. I personally usually just walk into the room again.

If the refresh option does work that would also prevent your rule from setting it to inactive on the occasion there is actual motion for extended periods of time

1 Like

Me too. This is why I've used custom drivers when needed to mitigate for this scenario.
I like to try and use in-built ones if I can.

It could be a device issue, zigbee mesh issue, Hub load issue and commands are missed, I've even had it occur when I've done a hub update and it's kicked in with an active motion sensor. Then it's "why hasn't the light turned off?".

Think I've had it happen once or twice, just changed the device driver to something like:

metadata {
	definition (name: "Virtual motion ", namespace: "thebearmay", author: "bear") {
		capability "Sensor"
		capability "Motion Sensor"
        command "motionActive"
        command "motionInactive"

def motionActive() {
    sendEvent(name: "motion", value: "active")
    runIn(12, off)

def motionInactive() {
    sendEvent(name: "motion", value: "inactive")

def installed() {

hit the inactive button, and changed it back to the original driver. (Took me longer to type this than to execute the process.)

1 Like

'Tis a very slippery slope when you resort to using software to overcome a hardware deficiency! Seriously, get a sensor that actually works.

1 Like

I have sensors that work thankyou. It is just something I can use when this rare occurrence arises.

I did say this in my original post.

Forget I asked.

1 Like

You can always just flip the driver over to Virtual Motion sensor, hit the command, then change the driver back.

It also isn't the best idea to drive your car after you've put "fix-a-flat" in the tire instead of actually repairing or replacing it. But it sure is nice having options when the time arises. Especially when on a tight budget.


Download the Hubitat app