I have been having fun getting into ESP32 for this project. I have a PowerPal that is too far from the home so using an ESP32 Atom Lite that’s half way between the PowerPal and the Home to connect and push the data back into HomeAssistant.
So far I have been able to sort it out with the M5Stack Atom Lite and its working. I have a couple of M5Stack Nano C6 ESP32 devices which I was keen to try and replace. This unit supports WiFi 6 802.11ax (2.4ghz) and has bluetooth, thread, zigbee radios etc.
The issue I am running into is that the Nano C6 uses the ESP-IDF framework not the Arduino framework. When I try and compile, the powerpal_ble component fails with the following error:
Compiling .pioenvs/nanoc6/src/esphome/components/ota/ota_backend_esp_idf.cpp.o
Compiling .pioenvs/nanoc6/src/esphome/components/powerpal_ble/powerpal_ble.cpp.o
Compiling .pioenvs/nanoc6/src/esphome/components/remote_base/abbwelcome_protocol.cpp.o
src/esphome/components/powerpal_ble/powerpal_ble.cpp:4:10: fatal error: WiFi.h: No such file or directory
**************************************************************
* Looking for WiFi.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:WiFi.h"
* Web > https://registry.platformio.org/search?q=header:WiFi.h
*
**************************************************************
4 | #include "WiFi.h"
| ^~~~~~~~
compilation terminated.
*** [.pioenvs/nanoc6/src/esphome/components/powerpal_ble/powerpal_ble.cpp.o] Error 1
In file included from src/esphome/components/remote_base/remote_base.h:12,
from src/esphome/components/remote_base/abbwelcome_protocol.h:5,
from src/esphome/components/remote_base/abbwelcome_protocol.cpp:1:
/data/cache/platformio/packages/[email protected]/components/driver/deprecated/driver/rmt.h:18:2: warning: #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h" [-Wcpp]
18 | #warning "The legacy RMT driver is deprecated, please use driver/rmt_tx.h and/or driver/rmt_rx.h"
| ^~~~~~~
========================= [FAILED] Took 26.93 seconds =========================
Is there any way to compile the build using ESP-IDF component?
When I was looking into the best framework to run Bluetooth BLE on ESP32 it also stated the ESP-IDF framework was best, specifically this:
The ESP32 Platform component should be configured to use the esp-idf framework, as the arduino framework uses significantly more memory and performs poorly with the Bluetooth proxy enabled. When switching from arduino to esp-idf , make sure to update the device with a serial cable as the partition table is different between the two frameworks as Over-the-Air Updates updates will not change the partition table.
Wondering if anyone can help? Particularly @muneeb1990 as I think your fork of the original component is what everyone is using?
Anyone have experience as to why the Daily Energy and Pulses goes to extreme values when the ESP32 device is restarted? If I wait till the next day, the energy monitoring works well, however a restart (like below) absolutely throws out the readings.
Below are some content from the logs on the ESP32 device (M5Stack Atom Lite)?
[19:04:48][C][powerpal_ble:013]: POWERPAL
[19:04:48][C][powerpal_ble:014]: Battery 'Powerpal Battery'
[19:04:48][C][powerpal_ble:014]: Device Class: 'battery'
[19:04:48][C][powerpal_ble:014]: State Class: ''
[19:04:48][C][powerpal_ble:014]: Unit of Measurement: '%'
[19:04:48][C][powerpal_ble:014]: Accuracy Decimals: 0
[19:04:48][C][powerpal_ble:015]: Power 'Powerpal Power'
[19:04:48][C][powerpal_ble:015]: Device Class: 'power'
[19:04:48][C][powerpal_ble:015]: State Class: 'measurement'
[19:04:48][C][powerpal_ble:015]: Unit of Measurement: 'W'
[19:04:48][C][powerpal_ble:015]: Accuracy Decimals: 0
[19:04:48][C][powerpal_ble:016]: Daily Energy 'Powerpal Daily Energy'
[19:04:48][C][powerpal_ble:016]: Device Class: 'energy'
[19:04:48][C][powerpal_ble:016]: State Class: 'total_increasing'
[19:04:48][C][powerpal_ble:016]: Unit of Measurement: 'kWh'
[19:04:48][C][powerpal_ble:016]: Accuracy Decimals: 3
[19:04:48][C][powerpal_ble:017]: Total Energy 'Powerpal Total Energy'
[19:04:48][C][powerpal_ble:017]: Device Class: 'energy'
[19:04:48][C][powerpal_ble:017]: State Class: 'total_increasing'
[19:04:48][C][powerpal_ble:017]: Unit of Measurement: 'kWh'
[19:04:48][C][powerpal_ble:017]: Accuracy Decimals: 3
[19:04:48][C][wifi_signal.sensor:010]: WiFi Signal 'RSSI'
[19:04:48][C][wifi_signal.sensor:010]: Device Class: 'signal_strength'
[19:04:48][C][wifi_signal.sensor:010]: State Class: 'measurement'
[19:04:48][C][wifi_signal.sensor:010]: Unit of Measurement: 'dBm'
[19:04:48][C][wifi_signal.sensor:010]: Accuracy Decimals: 0
[19:04:48][C][wifi_info:010]: WifiInfo IPAddress 'IP Address'
[19:04:48][C][wifi_info:012]: WifiInfo SSID 'Connected SSID'
[19:04:48][C][wifi_info:013]: WifiInfo BSSID 'Connected BSSID'
[19:04:48][C][wifi_info:015]: WifiInfo DNS Address 'DNS Address'
[19:04:48][C][wifi_info:010]: WifiInfo IPAddress 'My IP Address'
[19:04:48][C][homeassistant.sensor:030]: Homeassistant Sensor 'ha_daily_pulses'
[19:04:48][C][homeassistant.sensor:030]: State Class: ''
[19:04:48][C][homeassistant.sensor:030]: Unit of Measurement: ''
[19:04:48][C][homeassistant.sensor:030]: Accuracy Decimals: 1
[19:04:48][C][homeassistant.sensor:031]: Entity ID: 'sensor.powerpal_daily_pulses'
[19:04:48][D][text_sensor:064]: 'M5Stack Atom Lite Uptime': Sending state '0d 00h 31m 50s'
[19:05:03][D][esp32_ble_client:110]: [0] [F8:38:6A:21:7B:F5] ESP_GATTC_NOTIFY_EVT
[19:05:03][D][powerpal_ble:379]: [F8:38:6A:21:7B:F5] Received Notification
[19:05:03][D][powerpal_ble:390]: Recieved measurement notify event
[19:05:03][D][powerpal_ble:049]: Meaurement: DEC(20): 0xf09977671a000020dc5700200090d003ff00ffff
[19:05:03][I][powerpal_ble:064]: Timestamp: 1735891440, Pulses: 26, Average Watts within interval: 1560.000000 W, Daily Pulses: -2147482324
[19:05:03][D][sensor:094]: 'Powerpal Power': Sending state 1560.00000 W with 0 decimals of accuracy
[19:05:03][D][sensor:094]: 'Powerpal Cost_json': Sending state 0.00000 with 11 decimals of accuracy
[19:05:03][D][sensor:094]: 'Powerpal Pulses_json': Sending state 26.00000 with 0 decimals of accuracy
[19:05:03][D][sensor:094]: 'Powerpal Watt Hours_json': Sending state 26.00000 with 0 decimals of accuracy
[19:05:03][D][sensor:094]: 'Powerpal Timestamp_json': Sending state 1735891456.00000 with 0 decimals of accuracy
[19:05:03][D][sensor:094]: 'Powerpal Total Energy': Sending state 1.35100 kWh with 3 decimals of accuracy
[19:05:03][D][sensor:094]: 'Powerpal Daily Energy': Sending state 2147485.00000 kWh with 3 decimals of accuracy
[19:05:03][D][sensor:094]: 'Powerpal Daily Pulses': Sending state 2147484928.00000 with 0 decimals of accuracy
[19:05:03][W][component:237]: Component esp32_ble took a long time for an operation (119 ms).
[19:05:03][W][component:238]: Components should block for at most 30 ms.
[19:05:28][D][sensor:094]: 'Free Memory': Sending state 53.00000 kB with 1 decimals of accuracy
[19:05:29][D][internal_temperature:092]: Ignoring invalid temperature (success=0, value=53.3)
[19:05:40][I][ble_rssi_sensor:049]: ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT RSSI: -85
[19:05:40][D][sensor:094]: 'Powerpal BLE RSSI': Sending state -85.00000 dBm with 0 decimals of accuracy
[19:05:43][D][sensor:094]: 'RSSI': Sending state -79.00000 dBm with 0 decimals of accuracy
[19:05:45][D][sensor:094]: 'uptime_s': Sending state 1970.44702 s with 0 decimals of accuracy
[19:05:48][D][text_sensor:064]: 'M5Stack Atom Lite Uptime': Sending state '0d 00h 32m 50s'
[19:06:03][D][esp32_ble_client:110]: [0] [F8:38:6A:21:7B:F5] ESP_GATTC_NOTIFY_EVT
[19:06:03][D][powerpal_ble:379]: [F8:38:6A:21:7B:F5] Received Notification
[19:06:03][D][powerpal_ble:390]: Recieved measurement notify event
[19:06:03][D][powerpal_ble:049]: Meaurement: DEC(20): 0x2c9a776719000020dc5700200090d003ff00ffff
[19:06:03][I][powerpal_ble:064]: Timestamp: 1735891500, Pulses: 25, Average Watts within interval: 1500.000000 W, Daily Pulses: -2147482298
[19:06:03][D][sensor:094]: 'Powerpal Power': Sending state 1500.00000 W with 0 decimals of accuracy
[19:06:03][D][sensor:094]: 'Powerpal Cost_json': Sending state 0.00000 with 11 decimals of accuracy
[19:06:03][D][sensor:094]: 'Powerpal Pulses_json': Sending state 25.00000 with 0 decimals of accuracy
[19:06:03][D][sensor:094]: 'Powerpal Watt Hours_json': Sending state 25.00000 with 0 decimals of accuracy
[19:06:03][D][sensor:094]: 'Powerpal Timestamp_json': Sending state 1735891456.00000 with 0 decimals of accuracy
[19:06:03][D][sensor:094]: 'Powerpal Total Energy': Sending state 1.37600 kWh with 3 decimals of accuracy
[19:06:03][D][sensor:094]: 'Powerpal Daily Energy': Sending state **2147485.00000 kWh** with 3 decimals of accuracy
[19:06:03][D][sensor:094]: 'Powerpal Daily Pulses': **Sending state 2147484928.00000** with 0 decimals of accuracy
[19:06:03][W][component:237]: Component esp32_ble took a long time for an operation (125 ms).
[19:06:03][W][component:238]: Components should block for at most 30 ms.
So I managed to fix the issue with a bit of help from Claude AI.
I removed the Friendly Name so that the sensor name for the daily pulse backup is correct in HomeAssistant. I have also updated the following in my ESP Configuration YAML:
Might be useful for someone with the same issue in the future.
esphome:
name: powerpal-gateway
on_boot:
then:
- lambda: |-
uint32_t stored_pulses = id(powerpal_daily_pulses_backup);
if (stored_pulses > 100000) { // Reasonable maximum for daily pulses
stored_pulses = 0;
}
id(powerpal_ble_sensor)->daily_pulses_ = stored_pulses;
globals:
- id: powerpal_daily_pulses_backup
type: uint32_t # Change from int to uint32_t
restore_value: true
initial_value: '0' # Add initial value
- platform: homeassistant
id: ha_daily_pulses
entity_id: sensor.powerpal_daily_pulses
internal: true
filters:
- filter_out: nan
on_value:
then:
- globals.set:
id: powerpal_daily_pulses_backup
value: !lambda |-
if (isnan(x) || x < 0 || x > 100000) {
return id(powerpal_daily_pulses_backup);
}
return (uint32_t) x;
This is likely a flat battery in your PowerPal. They’ll replace it for free, though you might need to display app screenshots showing the disconnections. First time mine happened, it we’d dropping out for hours at a time every few days, then daily, then multiple days would go missing and it could grab a little more. Seemed very odd to me, they diagnosed it as flat battery immediately and sent a replacement.
I’m due for my 4th PowerPal early this year. I don’t know how long they’ll continue replacing them, but indefinitely is not the likely answer.
For anyone curious, they’re rated for 1yr but from my experience between 9mths - 14mths is the norm.
But get ready to deploy your own pulse readers, because PowerPal must have an EOL date. Support know me by now, I might. See it I can get anything out of them
New chip isn’t going to resolve your issues so long as you continue using BT you’ll be bound by its limitations (along with each of the technology on the new chip, non of which offer an outstanding improvement .
LoRA is the IoT go to for long range transmission or 433MHz I believe can give up to 100m LoS but isn’t really it’s key feature, it’s transmission through obstacles. Third option would be a point to point wireless link, depending on distance though 20ghz satellites will get costly, but are good for many kilometres with good alignment.
There certainly are options, though I’m unsure what you’re intending to resolve with the new chip…
All ESP use the ESP IDF… The people who make the chip provide the framework for communicating with the chip. The fact that Arduino is possible is become someone writes the necessary for Arduino. Now ESP function has nothing to do with Arduino, it simply hides the lower level development IDE making it accessible to more users.
You want the ESP SDK along with the ESP IDE. I must say however, if you weren’t already aware of this, you may find it rather difficult to get setup and operational. It’s not Arduino - there’s a reason Arduino succeeded at entering the consumer marketplace, and I believe that lies solely within the IDE and its ability to support so many different MCU through a single easy to use interface.
I must ask though - under what circumstances/deployment is not within
Hi… I have had my powerpal for probably 2.5 years, it still shows battery at about 97%.
I did get a newer esp32 wit USBC and it seems to be better, however as I mentioned back in March 24, when it is a warm/hot day it seems to not like it as it has gone offline this morning.
It did this the last few times the weather got over 30, and it happened in the morning when the sun is in the east as that is where it faces …
I should probably get a new one soon. Since you seem to know them @nasha do you know the website/phone number for them…
HA told me I should upgrade my ESPHome, but after going through the upgrade process for other implementations successfully, I get an error on the PowerPal one using @WeekendWarrior1 Github. Doesn’t look like it has been updated for a while.
Here is the error:
INFO ESPHome 2025.2.2
INFO Reading configuration /config/esphome/powerpal-esp32.yaml...
INFO Detected timezone 'Australia/Sydney'
INFO Generating C++ source...
INFO Compiling app...
Processing powerpalble (board: esp32dev; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- WiFi @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- Update @ 2.0.0
Compiling .pioenvs/powerpalble/src/esphome/components/ble_client/ble_client.cpp.o
Compiling .pioenvs/powerpalble/src/esphome/components/logger/logger.cpp.o
In file included from src/esphome/components/ble_client/ble_client.cpp:5:
src/esphome/components/ble_client/ble_client.h:89:8: error: conflicting return type specified for 'virtual void esphome::ble_client::BLEClient::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)'
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
^~~~~~~~~~~~~~~~~~~
In file included from src/esphome/components/ble_client/ble_client.cpp:4:
src/esphome/components/esp32_ble_tracker/esp32_ble_tracker.h:171:16: note: overridden function is 'virtual bool esphome::esp32_ble_tracker::ESPBTClient::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)'
virtual bool gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
^~~~~~~~~~~~~~~~~~~
*** [.pioenvs/powerpalble/src/esphome/components/ble_client/ble_client.cpp.o] Error 1
========================== [FAILED] Took 1.88 seconds ==========================
Here is my Yaml:
esphome:
name: powerpalble
esp32:
board: esp32dev
framework:
type: arduino
external_components:
- source: github://WeekendWarrior1/esphome@powerpal_ble
# requires ble_client because I had to add some small features to authenticate properly
components: [ ble_client, powerpal_ble ]
logger:
api:
ota:
- platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# optional requirement to enable powerpal cloud uploading
#http_request:
# id: powerpal_cloud_uploader
# optional requirement used with daily energy sensor
time:
- platform: homeassistant
id: homeassistant_time
esp32_ble_tracker:
ble_client:
- mac_address: A6:68:9F:D3:23:33
id: powerpal
sensor:
- platform: powerpal_ble
ble_client_id: powerpal
power:
name: "Powerpal Power"
daily_energy:
name: "Powerpal Daily Energy"
energy:
name: "Powerpal Total Energy"
battery_level:
name: "Powerpal Battery"
pairing_code: 402169
notification_interval: 1
pulses_per_kwh: 1000
time_id: homeassistant_time # daily energy still works without a time_id, but recommended to include one to properly handle daylight savings, etc.
# http_request_id: powerpal_cloud_uploader
# cost_per_kwh: 0.1872 #dollars per kWh
# powerpal_device_id: 0000abcd #optional, component will retrieve from your Powerpal if not set
# powerpal_apikey: 4a89a298-b17b-23e7-a6c1-fcd1412e98ef #optional, component will retrieve from your Powerpal if not set
I managed to get it working for a few days by setting the framework version, but it was flaky and stopped working again last night. Not sure if related, busy investigating.
esp32:
framework:
type: arduino
version: "2.0.15"
Edit:
I think my problems might be battery related on the unit. I connected the app to it, restarted everything and now it seems to be working again.
I think if you upgraded ESPHome then all you need to do is pin the framework version and you should be good.