[RELEASE] Zooz Power Switch with State

I've seen a number of dedicated apps out there for laundry monitoring, but I was curious, having bought some of the ZEN15 outlets/switches, if I could add something a little more in-depth, and a little more generalized, to a power-monitoring outlet.

After much perusing of existing code by @krlaframboise and @ChrisUthe, I think I have something workable for my use case.

The general idea is that for a lot of devices, ranges of relevant power values can indicate the current state/activity they're performing. I wanted something that wouldn't need extra virtual devices and would expose that state as part of the driver itself. As such, I wanted to configure those ranges and associated labels, and be able to rename the "idle" and "finished" states as made sense for the application. The driver also provides a virtual PushableButton, which will reset the state from "finished" to "idle".

Then, I can do any number of interesting things based on those behaviors, such as attach an Aqara Vibration sensor to the dishwasher door so that when the door is in the calibrated "open" position for more than 30 seconds when the dishes are clean, it transitions back to dirty again (allowing for a quick grab of a clean coffee mug in the morning when I don't feel like emptying the dishwasher :joy:).

Code is currently at hubitat/zooz-power-switch-with-state.groovy at main · ernie/hubitat · GitHub, and I'll add it to HPM if folks don't uncover that it's horribly broken in some way, or otherwise would find it useful.

4 Likes

Updated driver to add a virtual contact sensor which "opens" when the device is "finished" -- this lets Alexa routines trigger based on the finish event.

It's not quite the "Alexa, what's the status of the dishwasher" functionality I'd love to have, but as far as I can tell, Hubitat doesn't support Alexa's ModeController interface, which would be what's required for more granular information, I believe.

Please correct me if I'm wrong!

Been using your driver for awhile now and it works great for me. I have a suggestion ithough. I am going to look myself, but it is a bit of code and you could probably fix this faster than I could dig through and figure out how to do it.

A couple of times my status has popped up running for no reason and what I have found is that every now and then the switch will report back a very large power number. Yesterday it reported back a power level of >200Kwatts. This is of coarse a bogus reading. It also coincided with a hub reboot, not sure why that caused it but I think maybe it did.

So I think the easiest thing would be to add a way to put a max acceptable level to throw out obvious bogus readings. Another option might be to add a time it must stay above a power level to indicate a start reading.

I think the first option would be the easiest to implement. Anyway I will probably look at it sometime this weekend and see if I can put in a simple exit at the point the status changes to running if the reading is above a certain level.

Heya sir! PR would be accepted on this one. I think we just need to hardcode a silly-high value as a check. Don't have a lot of time to work on my Hubitat stuff at the moment.

I added the code shown below and it seems to work. I had basically forgotten about this. I figure it should never be above 1500 watts, I haven't gotten any bogus washer has started messages recently. Looking at the device page my high power reading shows a reading of over 130Kwatts. It aloso has a very low negative number for my low power reading. Zooz might should look at their firmware.

switch (meter?.name) {
case "power":
if (val < 1500) {
String newStatus = powerToStatus(val)
logDebug "Current Power jmp: $val"
if (newStatus != device.currentValue("status")) {
result << createEvent(
name: "status", value: newStatus,
descriptionText: "Updating status to $newStatus"
)
if (newStatus == finished) {
statusContact.open()
} else if (statusContact.currentValue("contact") != "closed") {
statusContact.close()
}
}}
break

Hi Ernie, thank you for this driver! I'm in the process of migrating my dishwasher/laundry notifications from SmartThings (WebCORE) to Hubitat and this should do nicely.

QQ: I understand the purpose of the child contact sensor, but could you please explain the purpose of the child switch? At first I thought it was meant to mirror the active/finished states but that doesn't seem to be the case (and it defaults to auto-off in 500ms so that's probably not the intention either). Is it supposed to be equivalent to a button press (setting the state to idle) and if so, what is the intended use case as distinct from using the button?

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.