Response from being Polled

I have a Red Dimmer (SN) and want to us it to verify power loss or my UPS rule.

Question is: When I poll a device or Ping a device what is the dimmers response?


The ping() command is really more of a SmartThings holdover, part of their “Health Check” capability — which Hubitat’s limited docs technically claim exist on that platform, but I have never seen it used in a driver they’ve made public (or anything to suggest that it’s used in any stock driver). I suspect it’s just a accidental leftover, a step farther than they were actually willing to go in imitating ST’s device/“Thing” model. (This is a bit problematic, there, too — or at least it was the last time I used the platform on a regular basis. A frequent recommendation to avoid problems was to turn off the Device Health feature that, it appears, relies on this.)

Anyway, to get back your question: in their driver, it looks like ping() just calls refresh(), and at least on Hubitat the effect of either would be the same. In Z-Wave terms, it will send a “Basic Get” to the device, which will in turn cause the device to send a message back to the hub containing its current switch (on/off) state and, I think, level. This won’t generate an event by default on Hubitat unless one of these values actually changes (unlikely since it should accurately report back with changes), but it does appear to update the “Last Activity At” field on the device itself. If you have debug logging enabled, you’re likely to see debug log entries about it parsing a “BasicGet” along with some Z-Wave-friendly (less human-friendly) data about what it contains. With Inovelli’s drivers, it looks like you’ll also see a human-friendly info log (if you have info/descriptionText logging enabled) regardless of whether or not the value actually changed (I don’t think most Hubitat stock drivers do this).

That being said, in my experience, the “Last Updated At” field tends to be updated pretty frequently on its own with regular reports coming back from the switch, especially if you’re using features of the LZW31-SN like power monitoring (which in the original firmware I guess you can’t truly disable, so if you have a neutral wire — required to use this — I guess you are, but the next version fixes this). I’d be hesitant to recommend pinging/refreshing it on a frequent basis as a way to check for power loss — that’s likely a lot of unnecessary traffic on your Z-Wave network. (You’d have to do something like ping it every few minutes, then check it a few seconds or so later to see if “Last Activity At” updated, which you’d need a custom app for since Rule Machine and no native app I’m aware of can directly access that field. Device Watchdog would be a good choice, though again I’m not sure I’d recommend it for this.) Proactively getting a report would be better than polling to get it, which is basically what this would amount to (you may have seen advice not to poll, particularly on Z-Wave, unless you really need to).

If you’re interested in power-loss monitoring ideas on Hubitat, this thread has lots of ideas:

I was thinking of doing something similar with a basic USB charger connected to some 5V relay (if I can find something like that; lots of people use easy-to-find 12V automobile relays, but USB is such an easy power source to come by…) and connect it to external contacts on something like the Ecolink Z-Wave Plus contact sensor, which itself would be battery powered and enable me to know when the open/close state changes. Still haven’t bothered to do that. :slight_smile: The “Environment Sensor” module by ihiyardi on the forums would also be a good choice, or so I’ve heard — I only have the older one without the battery, so I’m not sure how the new ones report power loss (but they could). Looks like he just got more made!

Don’t want to steer you too hard toward any options, and someone might have better ideas, but I’m not sure most in-wall switches/dimmers would be a good choice for this. Hope you find something, whatever it is that may work for you!

Thank you for such a complete reply.

I am currently working on a small low cost UPS for my Hub. While writing this response the UPS is running with power off to see how long it lasts and the recovery after being completely depleted.

I’m using one of @iharyadi designed board. It is a Zigbee board and runs on 5V. It outputs status every 5 minutes and I already have it deployed. I use it only to shutdown the Hub at some time after power loss based on the UPS’s expected hold up time.

I thought I might be able to use one of the other installed devices as a backup power loss sensor to not shut things down if the Zigbee board stopped communicating.

Hmm, in this limited case, I could see that not being a terrible burden on your network. I would say maybe something like a rule that triggers based on the ihiyardi board reporting power off, then refreshing the Inovelli switch, and waiting a bit of time to see if it did anything (so just one refresh, not constant polling), but then we’re still stuck with the issue that Rule Machine can’t access “Last Activity At.” A custom app can, and Device Watchdog does, and you might be able to use its “Turn on this device if there is activity to report” (as long as you only make it report when inactive) to in turn have a switch that triggers a rule to shutdown your hub or otherwise contributes to your decision.

I might be mistaken but thought he mentioned that the board has a way to tell if it’s still communicating (able to do so on battery) but just happens to have lost AC (or really DC via USB) power. Mine is pre-battery, so I don’t really know. If that’s accurate, it shouldn’t do anything on loss of communication, so the main problem you’d be stuck with is if you’re temporarily unplugging it to move it somewhere else or whatnot (shouldn’t be a problem with a sufficient, cancelable delay in a rule). If the sensor and the driver can’t already do this, I must have misinterpreted, but it seems like it would be a nice thing to add if everything’s there. :slight_smile:

My board is pre-battery as well. I wired in a Lillypad LED and hot glued it above the Lux sensor. The Lillypad is switched by the external contact I am monitoring with this board.
So the 5 minute report is great for watching power.

The Refresh was just an “extra” to double check the mains loss, but it’s not mandatory.

Unfortunately my UPS testing today did nto go as I hoped. The board powered the HUB but when depleted would not recover.