Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 11 made on Friday November 20, 2020 at 17:25
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,609
On November 20, 2020 at 11:53, sebastian said...
I wrote a small library (intended for personal use) that reports the battery status to my HomeAssistant instance.
I already shared the code with Fischi (I put it on GitHub a while ago: [Link: github.com] ), but I'm unable to provide any help adapting it to HomeSeer.

My main reason for doing this was that I only have limited trust in 10+ years old Li-ion batteries (or new cheap chinese ones sourced from EBay) - so my Pronto's dock is not plugged in all the time and I'm only charging mine when necessary.
I have added a wireless power plug that turns on the dock on when the battery state turns "red" and turns it off when the battery is fully charged.

The System.getBatteryStatus() returns one of the following values (ordered by increasing battery level):
empty / critical / level1 / level2 / level3 / level4 / max / charging

The behavior when charging is that the battery level switches to "charging" when the unit is charging (no surprise here) and when the battery is full (i.e. the dock's red charging light turns off), it "drops" to "max".

In my HomeAssistant automation, I'm using the drop from charging to max to turn off the dock's power.

Another thing is that I have my WiFi set to turn off after (i think) 15 minutes or so.
That means that I don't get continuous battery status updates  when the unit is not charging, but only when it's in use - which is sufficient for my use case as the battery only drains very slowly when the unit is just lying there unused with wifi turned off.
As long as the unit sits in the dock and is being charged, wifi is not deactivated, which is nice as it allows to reliably catch the point where the battery is fully charged.

The code itself is pretty easy to understand, I think, if you take a little time an try to understand what happens.
Maybe the trickiest part is the scheduling of the periodic updates as I didn't want to send an update every time an activity is changed

Sebastian

That use case make sense to me as you are cutting power to the dock.

Thanks for sharing the Github link. Nicely done and great example of using System Global, Activity scheduleAfter, onExit, and onWake.
Lyndel McGee
Philips Pronto Addict/Beta Tester


Hosting Services by ipHouse