Polling a device for battery level with the CCAPI #289
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @jmbaute, What you have is correct. But the clue is in the fact it's a battery operated device. You see, battery operated devices employ a "wake up" interval, and in doing so, will automatically report the battery when they wake up in that interval. Can you change it? - sure, as long as it does actually have a wake interval, see below. Battery operated devices are not "listening" for requests - and will only awake on the interval I mentioned or when they are triggered to do so, i.e a change in temp, motion etc etc Any requests you have sent will be queued, and processed when the device checks in on its interval You can just use the Value API if you wanted to get the battery level as it was last reported. I don't recommend the CCAPI - the Value API is far superior. |
Beta Was this translation helpful? Give feedback.
-
Quite likely, the manual of the device, should offer more explanation, some devices have a config setting also (Configuration CC), that may control this aspect - its really down to the manufacture what they do with reporting the battery.
The Value API stores ALL values that the device will report, and you can fetch these values at anytime, (as they are stored) - The CCAPI - is extremely low level, so does not offer any type of caching. The Value API data cache is resistant to reboots, as its written to disc when the values are updated.
The changes are queued, and will get applied, when the device awakes. |
Beta Was this translation helpful? Give feedback.
Hi @jmbaute,
What you have is correct.
But the clue is in the fact it's a battery operated device.
It is not awake to receive your request to report the battery - and in fact may not be needed at all...
You see, battery operated devices employ a "wake up" interval, and in doing so, will automatically report the battery when they wake up in that interval.
Can you change it? - sure, as long as it does actually have a wake interval, see below.
Battery operated devices are not "listening" for requests - and will only awake on the interval I mentioned or when they are triggered to do so, i.e a change in temp, motion etc etc
Any requests you have sent will be queued, and processed when the dev…