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

Login:
Pass:
 
 

Topic:
Pronto Battery status
This thread has 12 replies. Displaying all posts.
Post 1 made on Thursday November 19, 2020 at 10:57
Fischi
Long Time Member
Joined:
Posts:
January 2011
89
Hi, I want to send the battery status from my Pronto to my HA system (HomeSeer).

System.getBatteryStatus()

There is a UDP listener plugin for HomeSeer that listens on a defined port for incoming UDP.

How to send the battery status over UDP ?

Regards, Fischi
Post 2 made on Thursday November 19, 2020 at 12:08
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,582
Regarding a plugin...

Have you seen this? Googled for Homeseer UDP

[Link: forums.homeseer.com]
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 3 made on Thursday November 19, 2020 at 12:46
Fischi
Long Time Member
Joined:
Posts:
January 2011
89
Lyndel, I've installed this plugin (drhsip plugin) years ago and I'm using it for my ip relays.
Now I want my Prontos to send battery status to HomeSeer using this plugin.
Is this possible and what do I have to do ?

Fischi
OP | Post 4 made on Thursday November 19, 2020 at 13:28
Fischi
Long Time Member
Joined:
Posts:
January 2011
89
There is another plugin for HomeSeer : Big5
Big5 supports HTTP, TCP, MQTT, Serial (RS232/485), Chat/Messaging, REST API and JSON API.
Is it possible to send the battery status using one of these protocols ?

Fischi
Post 5 made on Thursday November 19, 2020 at 15:21
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,582
When the Pronto goes to sleep not on the dock, script does not run all the time. It wakes up every 55 seconds or so to keep WIFI active and script may run a few instructions before going to sleep.

If you are worried about Pronto Battery level, then it is likely you don't have the unit in the dock which means consistently reliable script execution is not possible and hence notification to Homeseer will be spotty at best.

If the unit is in the dock, I think that the the Battery Status will cycle when the unit is charging as the icon on the screen continually rotates through the various levels. IIRC, ProntoScript get's all these notifications such that someone could do a custom battery level icon via script to simulate the look and feel from Philips.

Is it worth the effort? Not in my opinion and I am not willing to jump in and write a script. However...


If it's HTTP or TCP, then yes, it is possible. If it's UDP, then yes, also possible. There are examples in the DEV guide for sending both TCP and UDP.

For any solution, you'd be required to know and understand the protocol to be able to write the script needed to notify Homeseer. The DEV guide has examples of sockets via TCP and UDP and the Philips HTTP Library can likely accomplish what you need for simple 1-way communication.

Someone also posted recently about integration of HTTP PUT and GET with Home Cinema via HTTP. I recommended possibly using the one-shot http examples from Philips which do not support POST body but rather simple GET encoded URLs.

[Link: remotecentral.com]
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 6 made on Thursday November 19, 2020 at 17:58
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,582
You also likely don't want to use System.getBatteryStatus() as you'd have to continually call this function at specific intervals.

The better way to do this would be to register for System Level events using System.addEventListener/System.removeEventListener

You should be able to drop this code into an Activity script and run on a remote. Note that you can also send data to an onscreen label with ProntoScript name of 'BATTERY'.

System.setDebugMask(9);

function myBatteryListener(aValue) {
System.print("batteryEvent:" + aValue);
var w = GUI.widget("BATTERY");
w && w.label = aValue;
}

System.addEventListener("battery",myBatteryListener);

//And, you'd likely want to remove the listener when exiting the activity to clean //things up.

// Here, CF.activity() and 'this' are the same.
this.onExit = function() {
System.removeEventListener("battery",myBatteryListener);
}
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 7 made on Friday November 20, 2020 at 00:31
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,582
On November 19, 2020 at 13:28, Fischi said...
There is another plugin for HomeSeer : Big5
Big5 supports HTTP, TCP, MQTT, Serial (RS232/485), Chat/Messaging, REST API and JSON API.
Is it possible to send the battery status using one of these protocols ?

Fischi

I just had a look at BIG5 and at first glance, it seems that this software is outbound meaning that it can connect to external sources via various protocols. Not sure it will do what you want.

Ideally, you'd want the Pronto to send the battery status to some homeseer plugin.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 8 made on Friday November 20, 2020 at 11:53
sebastian
Long Time Member
Joined:
Posts:
September 2003
69
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
OP | Post 9 made on Friday November 20, 2020 at 13:45
Fischi
Long Time Member
Joined:
Posts:
January 2011
89
Today I‘ve made some progress.
I‘ve tried the „single shot .xcf“ from the Pronto files.
It‘s possible to send data (values or strings) from the Pronto to HomeSeer
using the HomeSeer Big5 plugin over TCP.
This way it should be possible to send the Battery level over TCP to HomeSeer.

Kind regards,
Fischi
Post 10 made on Friday November 20, 2020 at 17:17
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,582
On November 20, 2020 at 13:45, Fischi said...
Today I‘ve made some progress.
I‘ve tried the „single shot .xcf“ from the Pronto files.
It‘s possible to send data (values or strings) from the Pronto to HomeSeer
using the HomeSeer Big5 plugin over TCP.
This way it should be possible to send the Battery level over TCP to HomeSeer.

Kind regards,
Fischi

A while back, someone was trying to use the Philips one-shot module to do Basic Authentication (MD5 digest). I did some work to integrate MD5 + UTF-8 into it so that the HTTP Authentication: Basic header could be sent.

If you run into an issue where this is required, email me.

Lyndel
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 11 made on Friday November 20, 2020 at 17:25
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,582
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
Post 12 made on Saturday November 21, 2020 at 05:53
sebastian
Long Time Member
Joined:
Posts:
September 2003
69
Thanks, Lyndel - but to be fair, you did help a lot, especially with the .onExit() stuff :)

Sebastian
OP | Post 13 made on Saturday November 21, 2020 at 11:54
Fischi
Long Time Member
Joined:
Posts:
January 2011
89
Lyndel and Sebastian,

I've got it without the SingleShot module.

I've used Sebastian's library as it is but removed the TOKEN part.

I've putted the library at System level and the script runs every 30 minutes by itself (I've changed it to 5 minutes).

I've used the Big5 HomeSeer plugin, watched the tcp traffic and noticed data.

Then I did some parsing and filtered the Battery Status (as value between 0-100) and the serial numbers of my TSU's out.

Depending on the Battery Status now I can switch on/off a z-wave wall plug or give notifications to my Handy.

Now all is running perfect.

Many thanks,

Fischi


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse