I am new to Home Assistant and this is my first plea for help …
I thought I would start by getting Powerpal to display in Home Assistant using @mindmelting 's code. To obtain the elusive API, I followed @Dean2706 's instructions, but when I try to configure the patched Powerpal .apk on my Samsung Galaxy S9, I get the error message:
“TypeError: Cannot read property ‘map’ of undefined”
I have no idea what that means, but I assume it is because that .apk is version 1.16.1, but the current version is 1.24.1?
I am preared to try to remove the security using “apk-mitm”, but I don’t know how to obtain the latest .apk package in order to modify it.
I’m keen to look more into getting a real time readout…I’ve done some testing with powerpal pro and it appears to be adaptive to whether the power is changing or not. The update rate is extremely fast under changing loads, e.g. I was turning a kettle on and off and seeing the update interval range from ~1-2 seconds with the powerpal app open in foreground on phone (with BLE turned off on phone so it can’t have been directly connected to powerpal unit). Can also see on wireshark the cloud report rate from the pro following this adaptive timing.
With constant load it dropped back to around 30+sec.
This leaves me with a few possible pathways to pursue over the christmas break:
attempt to intercept the powerpal pro cloud reports so they could be consumed directly/locally
figure out how the phone app is able to get such rapid updates via cloud and replicate in the cloud polling home assistant integration, which is what I currently use but currently limited to updates once per 60 seconds (less ideal, prefer local)
The most optimal option: switch to esp32 with the code here and attempt to replicate on BLE whatever the powerpal pro is doing to achieve adaptive real time updates
If anyone has any further info I’m keen to hear it - thanks
Update:
First, thanks for the work on this - really awesome stuff
The external component ble_client shouldn’t be needed any more, but I haven’t looked deeply enough to be sure. I’m running just powerpal_ble external, with some small changes to be compatible with current beta branch of esphome ble_client:
find and replace in powerpal_ble.cpp:
a) ‘conn_id’ with ‘get_conn_id()’
b) ‘gattc_if’ with ‘get_gattc_if()’
c) ‘remote_bda’ with ‘get_remote_bda()’
With that it’s running happily for the past half hour for me. It had no issue just connecting and working first run
Will play around more tomorrow or maybe next weekend
hello, first of all, thanks for sharing this work. I’m really keen to use this.
However I am having trouble using…I have tried through home assistant and esphome standalone (docker) and same error (attached) - looks like there is a definition conflict during compilation.
This is happening even when using the stock sample powerpal_ble.yaml
Any suggestions? I can work with python but C++ is beyond me
I have been experiencing the same issue as tlee17, above, on a Mac running HASS in VirtualBox, and on a PC with ESPHome standalone. Same error when compiling to the M5Stack Atomlite, and an M5StackCore. Hope someone can help with this!
I’m now seeing the same errors as well, even though I haven’t changed anything for a few weeks (other than updates). @muneeb1990 just to clarify your point, which file are you proposing needs to be edited? Thanks
Hi Guys, just checking if there was any updates on the fail to compile issue since 2022.11.0 ? Bad timing for me I got my Powerpal a couple of weeks ago with plans to integrate into HA, I’m not much of a coder but I’ve tried using @starryalley version of powerpal_ble & ble_client and compiling as a local source and it still fails when it gets to [.pioenvs/powerpal/src/esphome/components/ble_client/automation.cpp.o] and [.pioenvs/powerpal/src/esphome/components/ble_client/ble_client.cpp.o]
There is a good chance that I’m not doing something right !, but it comes back with these.
Hey folks, sorry been crazy busy these past few weeks. I finally got around to creating a fork with my changes. More details here. In addition to fixing the compile errors, I’ve also added sensors for timestamp, cost, pulses and watt_hours to use HA REST commands to upload to cloud so you can see your usage in Powerpal app without connecting your phone with the device. This is completely optional though.
This setup is tested and working on ESPHome 2022.11.3.
Does anyone know if weekendwarrior’s integration is still working for Powerpal energy monitoring? I’ve tried a number of fixes including the one muneeb1990 posted but am still getting the same error as compathack.
Hi @drew-t I got mine working 7 days back with @muneeb1990 code from above here, I copied his “powerpal_ble” & “http_request” to my pi4 microSD and pointed the .yaml at it to use as a local source to compile but only for components: [powerpal_ble, http_request] not the ble_client, and that worked well, the only thing is I don’t think its pushing to the Powerpal cloud, even after adding my device_id and apikey, but I might have done something wrong my end, hope this helps.
In saying that, I was looking at @muneeb1990 's powerpal_ble.h and I noticed it is referencing an internal ip address as possibly part of the cloud uploading, but I’m only a shade tree coder, so I might be of the mark totally. The powerpal_ble.h code below lines 145 - 150:-