Battery Handler
Posted: 13 Feb 2022 23:28
Hello...first time posting, but I have found many useful tidbits of info that have helped me with projects. Can't seem to find an answer to this one though.
No matter what I do, I can't seem to get the battery handler to work with SmartThings.
I'm using z-uno as a water sensor, to report just Wet or Dry (it's actually hooked up to the float sensor of my 12V backup sump pump). That part works great. The water sensor template in SmartThings also reports battery status...it was grayed out and 0%. Then I figured out once I set sleep mode to FREQUENTLY_AWAKE, the battery control came alive and reported 100%.
I then wanted to make a custom battery handler, and report back my sump pump battery status...can't seem to get that to ever fire though. It just keeps saying 100%. Here's what I tried just to get 50% out as a test:
byte batteryLevel=50;
ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_FREQUENTLY_AWAKE);
ZUNO_SETUP_BATTERY_HANDLER(getterBattery);
byte getterBattery() {
return batteryLevel;
}
I sent reports a bunch of times and left it on overnight...nothing.
I also tried zunoSendWakeUpNotification() to see if that would force a request for battery status, but even though it's right out of the reference section, the Arduino compiler says there's no function by that name. That's the first call I've ever had a problem with in the IDE. Everything else works fine.
I'm guessing there's something I'm missing in how to get SmartThings to ask for battery status, or I'm missing a key piece to setup the handler properly...just can't figure it out.
Any insights appreciated.
No matter what I do, I can't seem to get the battery handler to work with SmartThings.
I'm using z-uno as a water sensor, to report just Wet or Dry (it's actually hooked up to the float sensor of my 12V backup sump pump). That part works great. The water sensor template in SmartThings also reports battery status...it was grayed out and 0%. Then I figured out once I set sleep mode to FREQUENTLY_AWAKE, the battery control came alive and reported 100%.
I then wanted to make a custom battery handler, and report back my sump pump battery status...can't seem to get that to ever fire though. It just keeps saying 100%. Here's what I tried just to get 50% out as a test:
byte batteryLevel=50;
ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_FREQUENTLY_AWAKE);
ZUNO_SETUP_BATTERY_HANDLER(getterBattery);
byte getterBattery() {
return batteryLevel;
}
I sent reports a bunch of times and left it on overnight...nothing.
I also tried zunoSendWakeUpNotification() to see if that would force a request for battery status, but even though it's right out of the reference section, the Arduino compiler says there's no function by that name. That's the first call I've ever had a problem with in the IDE. Everything else works fine.
I'm guessing there's something I'm missing in how to get SmartThings to ask for battery status, or I'm missing a key piece to setup the handler properly...just can't figure it out.
Any insights appreciated.