Has anyone tried using this hacs integeration if yes how to get Powerpal API Authorization Key and Powerpal Device ID?
Have a look around post 39 onwards. Or one of the questions on that python repo leads to some more info.
Hi guys
First of all, thanks to WeekendWarrior1 for writing āGitHub - WeekendWarrior1/powerpal_ble: Collection of code, tools and documentation for data retrieval over BLE from your Powerpalā
I am using esp32. the problem is, it runs and shows
'BLE Advertised Device found: Name: Powerpal 0000f176, Address: ca:cf:f1:3d:77:75, serviceUUID: 59daabcd-12f4-25a6-7d4f-55961dce4205
Attempting to connect to deviceā¦
Found our device
Forming a connection to ca:cf:f1:3d:77:75
- Created client
onConnect
MTU:23
- Connected to server
Attempting to get battery serviceā¦
onSecurityRequest
onAuthenticationComplete
auth_cmpl.success`
After this line, it stops and nothing happens.
The only thing that I need is real-time power consumption.
Thank you for your help.
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.
Any advice would be greatly appreciated ā¦
OK, I should have done this before I posted my āplea for helpā ā¦
A simple Google search pointed me to APKPure and I was able to download the latest Powerpal.apk from Google Play ā¦
Now to see if I can remove the security restrictions ā¦ and finally discover the API.
Just wondering if this got committed? Iām finding the same issue, counter resets to 0 when ESP32 rebootsā¦
Very interesting work
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
thanks
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!
When youāre replacing gattc_if
with get_gattc_if()
, do not change it in this line:
void Powerpal::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
esp_ble_gattc_cb_param_t *param) {
Hopefully that solves the compilation errors.
Iām also seeing this error and am using a M5Stack Atom Lite as well.
Perhaps @WeekendWarrior1 might have some thoughts?
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
Check this PR. I have just configured it 2 days ago with the fix. Note that I have to change more source files for it to compile. ESPHome 2022.11.0 compatibility by ashmckenzie Ā· Pull Request #3 Ā· WeekendWarrior1/esphome Ā· GitHub
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.
virtual bool gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
^
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
^
virtual bool gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
^
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.
Bingo @muneeb1990 , Youāre a star. compiled with your code, working well. Thanks for your efforts. Cheers
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.