Powerpal smart energy monitor

Localvolts provide 5 minute pricing. Amber do the 30 minute averaging you are referring to.

1 Like

I just updated my setup to 2024.6.6 and I now have uploading happening automatically to Powerpal as well, with no API key. I realised that my original device had flat batteries so they express posted me a new one, and as part of this worked on getting the uploading working again.

http_request:
  id: powerpal_cloud_uploader
  verify_ssl: false

That was the only thing I needed to include this time and it has been uploading to HA and Powerpal now for a week post setup. Otherwise very similar to the other code mentioned previously.

That’s interesting.

Did you retain these elements as follows?

    #powerpal_apikey: xxxxxxxxxxxxx
    powerpal_device_id: xxxxxx
    # http_request_id: powerpal_cloud_uploader
    cost_per_kwh: 0.30 #dollars per kWh

Nope I haven’t any of them set. I have the cost set in the Powerpal app instead, and it seems to be able to work out the device id. The only things specific to my Powerpal is the MAC in the ble_client section and then the pairing code in the sensor section. Other than that is has just worked out of the box when I renewed it all. It took until the next day for everything to start flowing properly, but it has been updating no issue and my phone tells me it isn’t connected to the Powerpal.

Thanks for sharing that. I’ve just commented out all 4 of those lines now and will see if I get any update in Powerpal App tomorrow.

Hi @bavotto

No update of data in my Powerpal app today.

Any chance you could post your YAML files so I can compare with mine?

Anyone else manage to keep their Powerpal data uploading AFTER swpping out the Powerpal Pro with an ESP32? I’ve got the ESP32 working fine but would love to get upload working also.

nope same.
i assumehttps://github.com/WeekendWarrior1/esphome/tree/powerpal_ble/esphome/components/powerpal_ble needs updating to work.
its looking for a different format api key at the moment

This worked for me, however once written to the ESP I had to hit the ‘Restart Powerpal gateway’ button. Once that was done, it worked perfectly.

Folks,
I’ve tried to do the same but don’t get any data at all. Can someone tell me where I’m making the mistake - Here’s my logs & config files:

[00:06:48][D][esp32_ble_client:188]: [0] [E9:86:9E:5D:BE:9C] cfg_mtu status 0, mtu 23
[00:07:48][D][esp32_ble_client:172]: [0] [E9:86:9E:5D:BE:9C] ESP_GATTC_DISCONNECT_EVT, reason 8
[00:07:48][D][esp32_ble_client:110]: [0] [E9:86:9E:5D:BE:9C] ESP_GATTC_CLOSE_EVT
[00:07:58][D][esp32_ble_client:110]: [0] [E9:86:9E:5D:BE:9C] Found device
[00:07:58][D][esp32_ble_tracker:669]: Found device E9:86:9E:5D:BE:9C RSSI=-88
[00:07:58][D][esp32_ble_tracker:690]:   Address Type: RANDOM
[00:07:58][D][esp32_ble_tracker:692]:   Name: 'Powerpal'
[00:07:58][D][esp32_ble_tracker:219]: Pausing scan to make connection...
[00:07:58][D][esp32_ble_tracker:219]: Pausing scan to make connection...
[00:07:58][I][esp32_ble_client:067]: [0] [E9:86:9E:5D:BE:9C] 0x01 Attempting BLE connection
[00:07:59][D][esp32_ble_client:110]: [0] [E9:86:9E:5D:BE:9C] ESP_GATTC_CONNECT_EVT
[00:07:59][D][esp32_ble_client:110]: [0] [E9:86:9E:5D:BE:9C] ESP_GATTC_OPEN_EVT
[00:07:59][D][esp32_ble_tracker:270]: Starting scan...
[00:08:14][I][esp32_ble_client:333]: [0] [E9:86:9E:5D:BE:9C] auth complete. remote BD_ADDR: e9869e5dbe9c
[00:08:14][D][esp32_ble_client:341]: [0] [E9:86:9E:5D:BE:9C] auth success. address type = 1 auth mode = 1
[00:08:14][I][powerpal_ble:406]: [E9:86:9E:5D:BE:9C] Writing pairing code to Powerpal
[00:09:17][D][esp32_ble_client:306]: [0] [E9:86:9E:5D:BE:9C] Event 46
[00:09:19][D][esp32_ble_client:110]: [0] [E9:86:9E:5D:BE:9C] ESP_GATTC_SEARCH_CMPL_EVT
[00:09:19][I][esp32_ble_client:227]: [0] [E9:86:9E:5D:BE:9C] Connected
[00:09:19][D][esp32_ble_client:188]: [0] [E9:86:9E:5D:BE:9C] cfg_mtu status 0, mtu 23
[00:10:49][D][esp32_ble_client:172]: [0] [E9:86:9E:5D:BE:9C] ESP_GATTC_DISCONNECT_EVT, reason 8
[00:10:49][D][esp32_ble_client:110]: [0] [E9:86:9E:5D:BE:9C] ESP_GATTC_CLOSE_EVT

and here’s my YAML files:

esphome:
  name: powerpal-gateway
  friendly_name: Powerpal Gateway
  on_boot:
    - lambda: |-
        id(powerpal_ble_sensor)->daily_pulses_ = id(powerpal_daily_pulses_backup);

esp32:
  board: esp32dev
  framework:
    type: arduino

external_components:
  - source:
     type: git
     url: https://github.com/muneeb1990/esphome
     ref: powerpal_ble
    components: [ powerpal_ble ]

time:
  - platform: homeassistant
    id: homeassistant_time

ble_client:
  - mac_address:  # Replace with your powerpal mac id 00:00:00:00:00:00 
    id: powerpal

button:
  - platform: restart
    name: "Restart"
    icon: "mdi:restart"

globals:
  - id: powerpal_daily_pulses_backup
    type: int
    restore_value: true

# http_request:
#   id: powerpal_cloud_uploader

sensor:
  - platform: powerpal_ble
    id: powerpal_ble_sensor
    ble_client_id: powerpal
    power:
      name: "Powerpal Power"
    daily_energy:
      name: "Powerpal Daily Energy"
    daily_pulses:
      name: "Powerpal Daily Pulses"
    energy:
      name: "Powerpal Total Energy"
    battery_level:
      name: "Powerpal Battery"
    watt_hours:
       name: "Powerpal Watt Hours_json"
    cost:
       name: "Powerpal Cost_json"
    timestamp:
       name: "Powerpal Timestamp_json"
    pulses:
       name: "Powerpal Pulses_json"
    pairing_code: XXXXX
    notification_interval: 1
    pulses_per_kwh: 3200
    cost_per_kwh: 0.29
    time_id: homeassistant_time
    #powerpal_apikey:
    # powerpal_device_id: 

  - platform: homeassistant
    id: ha_daily_pulses
    entity_id: sensor.powerpal_daily_pulses
    on_value:
     then:
       - globals.set:
          id: powerpal_daily_pulses_backup
          value: !lambda 'return int(x);'

# Enable logging
logger:
# Enable Home Assistant API
api:
  encryption:
    key: ""

ota:
  - platform: esphome
    password: ""

wifi:
  ssid: ""
  password: ""

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Powerpal-Reader Fallback Hotspot"
    password: ""

captive_portal:
  
preferences:
  flash_write_interval: 10min

Make sure powerpal device is not connected to anything else.
I turned off every other bluetooth device in house to get it to connect.
Once connected you can re-enable bluetooth devices

I found something that really helped my issues - Stick the ESP32 as close as possible to the powerpal (within meters) - The gain on the ESP32 can be quite bad, ditto with WiFi issues.

I got around to setting this up yesterday and it seems to be working well - thanks to everyone who has worked on it!
The only issue is that the figures seem really high.
Is there anything obvious I might be missing in the settings?

    notification_interval: 1
    pulses_per_kwh: 3200
    http_request_id: powerpal_cloud_uploader
    cost_per_kwh: 0.2638
    time_id: homeassistant_time

When I look on the app, it says I’ve used 113kWh so far today (for 22 hours usage) - typically the app would show 5 or 6 kWh on a busy day. It now seems to think I’m used 6kw most of the time :smile:

Looking in HomeAssistant, the “_json” values seem reasonable, for example:

sensor.powerpalble_powerpal_cost_json = 0.00230824994
sensor.powerpalble_powerpal_daily_pulses = 41299
sensor.powerpalble_powerpal_pulses_json = 28
sensor.powerpalble_powerpal_timestamp_json = 1725796096
sensor.powerpalble_powerpal_watt_hours_json = 90

I think they are for the last minute, so multiplying those pulses, at 3200/kwh for a 24hr day (this should be higher than real figures as it’s a “busy” minute) would be:
(286024)/3200 = 12.6 kWh

I tried calling the Powerpal API directly, for a specific 59 second block and they matched the homeassistant values so I think the HTTP send is working ok too.

Has anyone else had really high numbers coming through, and if so - was it a setting that needed adjusting somewhere?

Could it be because I uncommented the HTTP request parts of the esphome yaml, and also set the automation up in HA? So it could be sending multiples?

Thanks!

Is it possible to connect to the Emerald Electricity Advisor without using an ESP32?

WeekendWarrior’s emerald_electricity_advisor repository says an ESP32 is needed, but I currently I use a bluetooth usb dongle to connect to my devices.

Thanks to the guides here I’ve managed to setup an m5stack atom lite to read the powerpal data and I think it is working well in HA.
I’m trying to upload the data to the powerpal API using HA automation but looking at the powerpal app the data is only shown for every 2nd 15 minute period. Does anyone have any suggestions on how to upload the data every 15 minutes?

home assistant code and powerpal app screenshot

configuration.yaml:

rest_command:
  my_request:
    url: https://readings.powerpal.net/api/v1/meter_reading/<device_id>
    method: POST
    headers:
      authorization: "<authorization_key>"
      accept: ""
    payload: >-
       [ {"cost":{{ states.sensor.powerpal_cost_json.state }},"is_peak": false, "pulses":{{ states.sensor.powerpal_pulses_json.state }}, "timestamp": {{ (int(states.sensor.powerpal_timestamp_json.state)//60) * 60 }}, "watt_hours": {{ int(states.sensor.powerpal_watt_hours_json.state)/5}} } ]
    content_type: 'application/json'
    verify_ssl: true

automations.yaml:

  alias: Powerpal Cloud Upload
  description: ''
  trigger:
  - platform: time_pattern
    minutes: /1
  condition: []
  action:
  - service: rest_command.my_request
    data: {}
    alias: Upload data
  mode: single

Here is a snippet of curl -H "Authorization: <authorization_key>" https://readings.powerpal.net/api/v1/meter_reading/<device_id> which shows that data is being uploaded approximately every 30 minutes:

meter_reading
  {
    "timestamp": 1726640880,
    "pulses": 31,
    "watt_hours": 19.8,
    "cost": 0.0036978275,
    "usage_cost": 0.0028183677,
    "fixed_cost": 0.00087945984,
    "cost_per_kwh": 0.14234181,
    "is_peak": false,
    "is_final": false,
    "samples": 1
  },
  {
    "timestamp": 1726642680,
    "pulses": 23,
    "watt_hours": 14.8,
    "cost": 0.0031337794,
    "usage_cost": 0.0022543196,
    "fixed_cost": 0.00087945984,
    "cost_per_kwh": 0.1523189,
    "is_peak": false,
    "is_final": false,
    "samples": 1
  },
  {
    "timestamp": 1726644480,
    "pulses": 26,
    "watt_hours": 16.6,
    "cost": 0.0042708763,
    "usage_cost": 0.0033914165,
    "fixed_cost": 0.00087945984,
    "cost_per_kwh": 0.20430219,
    "is_peak": false,
    "is_final": false,
    "samples": 1
  },
  {
    "timestamp": 1726646220,
    "pulses": 32,
    "watt_hours": 20.4,
    "cost": 0.005229091,
    "usage_cost": 0.004349631,
    "fixed_cost": 0.00087945984,
    "cost_per_kwh": 0.2132172,
    "is_peak": false,
    "is_final": false,
    "samples": 1
  }
]

Also I realised that the esphome logs show that the value for 'Powerpal Timestamp_json" is repeated twice in a row but the “powerpal_ble” timestamp changes each time (increases by 60 seconds). Is this expected behaviour?

esphome_log
INFO ESPHome 2024.8.3
INFO Reading configuration /config/powerpal-gateway.yaml...
INFO Starting log output from [redacted] using esphome API
INFO Successfully connected to powerpal-gateway @ [redacted] in 0.048s
INFO Successful handshake with powerpal-gateway @ [redacted] in 0.115s
[19:53:58][I][app:100]: ESPHome version 2024.8.3 compiled on Sep 18 2024, 19:50:08
[19:53:58][C][wifi:600]: WiFi:
[19:53:58][C][wifi:428]:   Local MAC: [redacted]
[19:53:58][C][wifi:433]:   SSID: [redacted]
[19:53:58][C][wifi:436]:   IP Address: [redacted]
[19:53:58][C][wifi:440]:   BSSID: [redacted]
[19:53:58][C][wifi:441]:   Hostname: 'powerpal-gateway'
[19:53:58][C][wifi:443]:   Signal strength: -52 dB ▂▄▆█
[19:53:58][C][wifi:447]:   Channel: 
[19:53:58][C][wifi:448]:   Subnet: 255.255.255.0
[19:53:58][C][wifi:449]:   Gateway: [redacted]
[19:53:58][C][wifi:450]:   DNS1: 0.0.0.0
[19:53:58][C][wifi:451]:   DNS2: 0.0.0.0
[19:53:58][C][logger:185]: Logger:
[19:53:58][C][logger:186]:   Level: DEBUG
[19:53:58][C][logger:188]:   Log Baud Rate: 115200
[19:53:58][C][logger:189]:   Hardware UART: UART0
[19:53:58][C][homeassistant.time:010]: Home Assistant Time:
[19:53:58][C][homeassistant.time:011]:   Timezone: 
[19:53:58][C][restart.button:017]: Restart Button 'Restart'
[19:53:58][C][restart.button:017]:   Icon: 'mdi:restart'
[19:53:58][C][esp32_ble:391]: ESP32 BLE:
[19:53:58][C][esp32_ble:393]:   MAC address: [redacted]
[19:53:58][C][esp32_ble:394]:   IO Capability: none
[19:53:58][C][ble_client:027]: BLE Client:
[19:53:58][C][ble_client:028]:   Address: redacted
[19:53:58][C][ble_client:029]:   Auto-Connect: TRUE
[19:53:58][C][esp32_ble_tracker:653]: BLE Tracker:
[19:53:58][C][esp32_ble_tracker:654]:   Scan Duration: 300 s
[19:53:58][C][esp32_ble_tracker:655]:   Scan Interval: 320.0 ms
[19:53:58][C][esp32_ble_tracker:656]:   Scan Window: 30.0 ms
[19:53:58][C][esp32_ble_tracker:657]:   Scan Type: ACTIVE
[19:53:58][C][esp32_ble_tracker:658]:   Continuous Scanning: True
[19:53:58][C][mdns:116]: mDNS:
[19:53:58][C][mdns:117]:   Hostname: powerpal-gateway
[19:53:58][C][esphome.ota:073]: Over-The-Air updates:
[19:53:58][C][esphome.ota:074]:   Address: [redacted]
[19:53:58][C][esphome.ota:075]:   Version: 2
[19:53:58][C][esphome.ota:078]:   Password configured
[19:53:58][C][safe_mode:018]: Safe Mode:
[19:53:58][C][safe_mode:020]:   Boot considered successful after 60 seconds
[19:53:58][C][safe_mode:021]:   Invoke after 10 boot attempts
[19:53:58][C][safe_mode:023]:   Remain in safe mode for 300 seconds
[19:53:58][C][api:139]: API Server:
[19:53:58][C][api:140]:   Address: [redacted]
[19:53:58][C][api:142]:   Using noise encryption: YES
[19:53:58][C][powerpal_ble:013]: POWERPAL
[19:53:58][C][powerpal_ble:014]:  Battery 'Powerpal Battery'
[19:53:58][C][powerpal_ble:014]:    Device Class: 'battery'
[19:53:58][C][powerpal_ble:014]:    State Class: ''
[19:53:58][C][powerpal_ble:014]:    Unit of Measurement: '%'
[19:53:58][C][powerpal_ble:014]:    Accuracy Decimals: 0
[19:53:58][C][powerpal_ble:015]:  Power 'Powerpal Power'
[19:53:58][C][powerpal_ble:015]:    Device Class: 'power'
[19:53:58][C][powerpal_ble:015]:    State Class: 'measurement'
[19:53:58][C][powerpal_ble:015]:    Unit of Measurement: 'W'
[19:53:58][C][powerpal_ble:015]:    Accuracy Decimals: 0
[19:53:58][C][powerpal_ble:016]:  Daily Energy 'Powerpal Daily Energy'
[19:53:58][C][powerpal_ble:016]:    Device Class: 'energy'
[19:53:58][C][powerpal_ble:016]:    State Class: 'total_increasing'
[19:53:58][C][powerpal_ble:016]:    Unit of Measurement: 'kWh'
[19:53:58][C][powerpal_ble:016]:    Accuracy Decimals: 3
[19:53:58][C][powerpal_ble:017]:  Total Energy 'Powerpal Total Energy'
[19:53:58][C][powerpal_ble:017]:    Device Class: 'energy'
[19:53:58][C][powerpal_ble:017]:    State Class: 'total_increasing'
[19:53:58][C][powerpal_ble:017]:    Unit of Measurement: 'kWh'
[19:53:58][C][powerpal_ble:017]:    Accuracy Decimals: 3
[19:53:58][C][homeassistant.sensor:030]: Homeassistant Sensor 'ha_daily_pulses'
[19:53:58][C][homeassistant.sensor:030]:   State Class: ''
[19:53:58][C][homeassistant.sensor:030]:   Unit of Measurement: ''
[19:53:58][C][homeassistant.sensor:030]:   Accuracy Decimals: 1
[19:53:58][C][homeassistant.sensor:031]:   Entity ID: 'sensor.powerpal_daily_pulses'
[19:54:04][D][esp32_ble_client:110]: [0] [redacted] ESP_GATTC_NOTIFY_EVT
[19:54:04][D][powerpal_ble:379]: [redacted] Received Notification
[19:54:04][D][powerpal_ble:390]: Recieved measurement notify event
[19:54:04][D][powerpal_ble:049]: Meaurement: DEC(20): 0xfca2ea6623000020dc5700200090d003ff00ffff
[19:54:04][I][powerpal_ble:064]: Timestamp: 1726653180, Pulses: 35, Average Watts within interval: 656.250000 W, Daily Pulses: 18191
[19:54:04][D][sensor:094]: 'Powerpal Power': Sending state 656.25000 W with 0 decimals of accuracy
[19:54:04][D][sensor:094]: 'Powerpal Cost_json': Sending state 0.00000  with 11 decimals of accuracy
[19:54:04][D][sensor:094]: 'Powerpal Pulses_json': Sending state 35.00000  with 0 decimals of accuracy
[19:54:04][D][sensor:094]: 'Powerpal Watt Hours_json': Sending state 112.00000  with 0 decimals of accuracy
[19:54:04][D][sensor:094]: 'Powerpal Timestamp_json': Sending state 1726653184.00000  with 0 decimals of accuracy
[19:54:04][D][sensor:094]: 'Powerpal Total Energy': Sending state 0.09344 kWh with 3 decimals of accuracy
[19:54:04][D][sensor:094]: 'Powerpal Daily Energy': Sending state 5.69562 kWh with 3 decimals of accuracy
[19:54:04][D][sensor:094]: 'Powerpal Daily Pulses': Sending state 18226.00000  with 0 decimals of accuracy
[19:54:04][W][component:237]: Component esp32_ble took a long time for an operation (118 ms).
[19:54:04][W][component:238]: Components should block for at most 30 ms.
[19:54:04][D][homeassistant.sensor:024]: 'sensor.powerpal_daily_pulses': Got state 18226.00
[19:54:04][D][sensor:094]: 'ha_daily_pulses': Sending state 18226.00000  with 1 decimals of accuracy
[19:55:04][D][esp32_ble_client:110]: [0] [redacted] ESP_GATTC_NOTIFY_EVT
[19:55:04][D][powerpal_ble:379]: [redacted] Received Notification
[19:55:04][D][powerpal_ble:390]: Recieved measurement notify event
[19:55:04][D][powerpal_ble:049]: Meaurement: DEC(20): 0x38a3ea6620000020dc5700200090d003ff00ffff
[19:55:04][I][powerpal_ble:064]: Timestamp: 1726653240, Pulses: 32, Average Watts within interval: 600.000000 W, Daily Pulses: 18226
[19:55:04][D][sensor:094]: 'Powerpal Power': Sending state 600.00000 W with 0 decimals of accuracy
[19:55:04][D][sensor:094]: 'Powerpal Cost_json': Sending state 0.00000  with 11 decimals of accuracy
[19:55:04][D][sensor:094]: 'Powerpal Pulses_json': Sending state 32.00000  with 0 decimals of accuracy
[19:55:04][D][sensor:094]: 'Powerpal Watt Hours_json': Sending state 102.00000  with 0 decimals of accuracy
[19:55:04][D][sensor:094]: 'Powerpal Timestamp_json': Sending state 1726653184.00000  with 0 decimals of accuracy
[19:55:04][D][sensor:094]: 'Powerpal Total Energy': Sending state 0.10344 kWh with 3 decimals of accuracy
[19:55:04][D][sensor:094]: 'Powerpal Daily Energy': Sending state 5.70563 kWh with 3 decimals of accuracy
[19:55:04][D][sensor:094]: 'Powerpal Daily Pulses': Sending state 18258.00000  with 0 decimals of accuracy
[19:55:04][W][component:237]: Component esp32_ble took a long time for an operation (108 ms).
[19:55:04][W][component:238]: Components should block for at most 30 ms.
[19:55:04][D][homeassistant.sensor:024]: 'sensor.powerpal_daily_pulses': Got state 18258.00
[19:55:04][D][sensor:094]: 'ha_daily_pulses': Sending state 18258.00000  with 1 decimals of accuracy
[19:55:58][D][esp32_ble_tracker:270]: Starting scan...
[19:56:04][D][esp32_ble_client:110]: [0] [redacted] ESP_GATTC_NOTIFY_EVT
[19:56:04][D][powerpal_ble:379]: [redacted] Received Notification
[19:56:04][D][powerpal_ble:390]: Recieved measurement notify event
[19:56:04][D][powerpal_ble:049]: Meaurement: DEC(20): 0x74a3ea661f000020dc5700200090d003ff00ffff
[19:56:04][I][powerpal_ble:064]: Timestamp: 1726653300, Pulses: 31, Average Watts within interval: 581.250000 W, Daily Pulses: 18258
[19:56:04][D][sensor:094]: 'Powerpal Power': Sending state 581.25000 W with 0 decimals of accuracy
[19:56:04][D][sensor:094]: 'Powerpal Cost_json': Sending state 0.00000  with 11 decimals of accuracy
[19:56:04][D][sensor:094]: 'Powerpal Pulses_json': Sending state 31.00000  with 0 decimals of accuracy
[19:56:04][D][sensor:094]: 'Powerpal Watt Hours_json': Sending state 99.00000  with 0 decimals of accuracy
[19:56:04][D][sensor:094]: 'Powerpal Timestamp_json': Sending state 1726653312.00000  with 0 decimals of accuracy
[19:56:04][D][sensor:094]: 'Powerpal Total Energy': Sending state 0.11312 kWh with 3 decimals of accuracy
[19:56:04][D][sensor:094]: 'Powerpal Daily Energy': Sending state 5.71531 kWh with 3 decimals of accuracy
[19:56:04][D][sensor:094]: 'Powerpal Daily Pulses': Sending state 18289.00000  with 0 decimals of accuracy
[19:56:04][W][component:237]: Component esp32_ble took a long time for an operation (116 ms).
[19:56:04][W][component:238]: Components should block for at most 30 ms.
[19:56:04][D][homeassistant.sensor:024]: 'sensor.powerpal_daily_pulses': Got state 18289.00
[19:56:04][D][sensor:094]: 'ha_daily_pulses': Sending state 18289.00000  with 1 decimals of accuracy
[19:57:04][D][esp32_ble_client:110]: [0] [redacted] ESP_GATTC_NOTIFY_EVT
[19:57:04][D][powerpal_ble:379]: [redacted] Received Notification
[19:57:04][D][powerpal_ble:390]: Recieved measurement notify event
[19:57:04][D][powerpal_ble:049]: Meaurement: DEC(20): 0xb0a3ea661f000020dc5700200090d003ff00ffff
[19:57:04][I][powerpal_ble:064]: Timestamp: 1726653360, Pulses: 31, Average Watts within interval: 581.250000 W, Daily Pulses: 18289
[19:57:04][D][sensor:094]: 'Powerpal Power': Sending state 581.25000 W with 0 decimals of accuracy
[19:57:04][D][sensor:094]: 'Powerpal Cost_json': Sending state 0.00000  with 11 decimals of accuracy
[19:57:04][D][sensor:094]: 'Powerpal Pulses_json': Sending state 31.00000  with 0 decimals of accuracy
[19:57:04][D][sensor:094]: 'Powerpal Watt Hours_json': Sending state 99.00000  with 0 decimals of accuracy
[19:57:04][D][sensor:094]: 'Powerpal Timestamp_json': Sending state 1726653312.00000  with 0 decimals of accuracy
[19:57:04][D][sensor:094]: 'Powerpal Total Energy': Sending state 0.12281 kWh with 3 decimals of accuracy
[19:57:04][D][sensor:094]: 'Powerpal Daily Energy': Sending state 5.72500 kWh with 3 decimals of accuracy
[19:57:04][D][sensor:094]: 'Powerpal Daily Pulses': Sending state 18320.00000  with 0 decimals of accuracy
[19:57:04][W][component:237]: Component esp32_ble took a long time for an operation (107 ms).
[19:57:04][W][component:238]: Components should block for at most 30 ms.
[19:57:04][D][homeassistant.sensor:024]: 'sensor.powerpal_daily_pulses': Got state 18320.00
[19:57:04][D][sensor:094]: 'ha_daily_pulses': Sending state 18320.00000  with 1 decimals of accuracy
[19:58:05][D][esp32_ble_client:110]: [0] [redacted] ESP_GATTC_NOTIFY_EVT
[19:58:05][D][powerpal_ble:379]: [redacted] Received Notification
[19:58:05][D][powerpal_ble:390]: Recieved measurement notify event
[19:58:05][D][powerpal_ble:049]: Meaurement: DEC(20): 0xeca3ea661a000020dc5700200090d003ff00ffff
[19:58:05][I][powerpal_ble:064]: Timestamp: 1726653420, Pulses: 26, Average Watts within interval: 487.500000 W, Daily Pulses: 18320
[19:58:05][D][sensor:094]: 'Powerpal Power': Sending state 487.50000 W with 0 decimals of accuracy
[19:58:05][D][sensor:094]: 'Powerpal Cost_json': Sending state 0.00000  with 11 decimals of accuracy
[19:58:05][D][sensor:094]: 'Powerpal Pulses_json': Sending state 26.00000  with 0 decimals of accuracy
[19:58:05][D][sensor:094]: 'Powerpal Watt Hours_json': Sending state 83.00000  with 0 decimals of accuracy
[19:58:05][D][sensor:094]: 'Powerpal Timestamp_json': Sending state 1726653440.00000  with 0 decimals of accuracy
[19:58:05][D][sensor:094]: 'Powerpal Total Energy': Sending state 0.13094 kWh with 3 decimals of accuracy
[19:58:05][D][sensor:094]: 'Powerpal Daily Energy': Sending state 5.73313 kWh with 3 decimals of accuracy
[19:58:05][D][sensor:094]: 'Powerpal Daily Pulses': Sending state 18346.00000  with 0 decimals of accuracy
[19:58:05][W][component:237]: Component esp32_ble took a long time for an operation (114 ms).
[19:58:05][W][component:238]: Components should block for at most 30 ms.
[19:58:05][D][homeassistant.sensor:024]: 'sensor.powerpal_daily_pulses': Got state 18346.00
[19:58:05][D][sensor:094]: 'ha_daily_pulses': Sending state 18346.00000  with 1 decimals of accuracy
[19:59:04][D][esp32_ble_client:110]: [0] [redacted] ESP_GATTC_NOTIFY_EVT
[19:59:04][D][powerpal_ble:379]: [redacted] Received Notification
[19:59:04][D][powerpal_ble:390]: Recieved measurement notify event
[19:59:04][D][powerpal_ble:049]: Meaurement: DEC(20): 0x28a4ea661b000020dc5700200090d003ff00ffff
[19:59:04][I][powerpal_ble:064]: Timestamp: 1726653480, Pulses: 27, Average Watts within interval: 506.250000 W, Daily Pulses: 18346
[19:59:04][D][sensor:094]: 'Powerpal Power': Sending state 506.25000 W with 0 decimals of accuracy
[19:59:04][D][sensor:094]: 'Powerpal Cost_json': Sending state 0.00000  with 11 decimals of accuracy
[19:59:04][D][sensor:094]: 'Powerpal Pulses_json': Sending state 27.00000  with 0 decimals of accuracy
[19:59:04][D][sensor:094]: 'Powerpal Watt Hours_json': Sending state 86.00000  with 0 decimals of accuracy
[19:59:04][D][sensor:094]: 'Powerpal Timestamp_json': Sending state 1726653440.00000  with 0 decimals of accuracy
[19:59:04][D][sensor:094]: 'Powerpal Total Energy': Sending state 0.13938 kWh with 3 decimals of accuracy
[19:59:04][D][sensor:094]: 'Powerpal Daily Energy': Sending state 5.74156 kWh with 3 decimals of accuracy
[19:59:04][D][sensor:094]: 'Powerpal Daily Pulses': Sending state 18373.00000  with 0 decimals of accuracy
[19:59:04][W][component:237]: Component esp32_ble took a long time for an operation (106 ms).
[19:59:04][W][component:238]: Components should block for at most 30 ms.
[19:59:04][D][homeassistant.sensor:024]: 'sensor.powerpal_daily_pulses': Got state 18373.00
[19:59:04][D][sensor:094]: 'ha_daily_pulses': Sending state 18373.00000  with 1 decimals of accuracy

For completeness, here is the esphome yaml.

powerpal-gateway.yaml
esphome:
  name: powerpal-gateway
  friendly_name: Powerpal Gateway #THE FRIENDLY NAME OF YOUR ESP Device
  on_boot:
    then:
      - lambda: |-
           id(powerpal_ble_sensor)->daily_pulses_ = id(powerpal_daily_pulses_backup);

esp32:
  board: m5stack-core-esp32
  framework:
    type: arduino

external_components:
  - source:
     type: git
     url: https://github.com/muneeb1990/esphome
     ref: powerpal_ble
    components: [ powerpal_ble ]

time:
  - platform: homeassistant
    id: homeassistant_time

ble_client:
  - mac_address: !secret powerpal_mac_address
    id: powerpal

button:
  - platform: restart
    name: "Restart"
    icon: "mdi:restart"

globals:
  - id: powerpal_daily_pulses_backup
    type: int
    restore_value: true

#http_request:
#  id: powerpal_cloud_uploader

sensor:
  - platform: powerpal_ble
    id: powerpal_ble_sensor
    ble_client_id: powerpal
    power:
      name: "Powerpal Power"
    daily_energy:
      name: "Powerpal Daily Energy"
    daily_pulses:
      name: "Powerpal Daily Pulses"
    energy:
      name: "Powerpal Total Energy"
    battery_level:
      name: "Powerpal Battery"
    watt_hours:
       name: "Powerpal Watt Hours_json"
    cost:
       name: "Powerpal Cost_json"
    timestamp:
       name: "Powerpal Timestamp_json"
    pulses:
       name: "Powerpal Pulses_json"
    pairing_code: !secret powerpal_pairing_code
    notification_interval: 1
    pulses_per_kwh: 3200
    time_id: homeassistant_time
#    powerpal_apikey: 
#    powerpal_device_id: 

  - platform: homeassistant
    id: ha_daily_pulses
    entity_id: sensor.powerpal_daily_pulses
    on_value:
     then:
       - globals.set:
          id: powerpal_daily_pulses_backup
          value: !lambda 'return int(x);'

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "<api_key>"
  password: !secret esphome_secret

ota:
  platform: esphome
  password: !secret esphome_secret

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: [redacted]
    # Set this to the IP address of the router. Often ends with .1
    gateway: [redacted]
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: [redacted]

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "[redacted]"
    password: "[redacted]"

preferences:
  flash_write_interval: 10min

hello

I have managed to get data from my Powerpal device using the api as described in this thread.

I have an iPad which is always on that can remain connected to it. I read somewhere that if the Powerpal app runs in the background, it only updates every 15 mins instead of every minute (when it runs in the foreground).

Does anyone know if this is true? If so, is there anyway to make it update every minute when running in the background?

Hey there. I have home assistant, but know very little. Can someone provide step by step instructions how how to install.

Eg there are references to ESPhome, which i kw nothing about and dont have installed, dont know where to get etc,

You will need an esp32 for this. Get one that can be programmed via USB. I used this one: https://www.aliexpress.com/item/1005002010800512.html

I was having issues with my Powerpal too for the last few months. Not sure what the catalyst was.
My Powerpal’s built-in battery died, so I replaced it with an old lipo. After fitting a new battery and it working for a while, that battery died too and then the powerpal stopped working - or at least it seemed to. I noticed I was getting battery %age, but not power usage.
During my troubleshooting phase, my new iPhone 16 Pro would not see the powerpal unit, so I deleted the pairing within the powerpal app ‘forgot powerpal’ and re-added it. Voila! Immediately upon a successful re-pair with the iPhone, power usage data was visible in the logs and started to be reported in HA.
Deleting and re-pairing the powerpal device in the app may seem like a first step in troubleshooting, however as it had been working previously, I had assumed that wouldn’t fix it - but always try the simplest solution first!!
…so in reply to the previous message in the thread, even if you’re NOT setting one of these up for the first time, try deleting the pairing in the app and re-pair as it might solve your problems.
Thanks @jdndm!

Team,

I’ve been doing lots of work with HA and I have bee a nerd for 35 years but I’m new to ESP32.

I have PowerPal setup. I know the paring code and the MAC address of the PowerPal.

I have a MMWave Sensor that has an esp32c3 in it. The device does not need the bluetooth for the normal sensor functionality. I am hoping to add the BLE bits into its config so that I can use it for PowerPal monitoring as well as the other sensor bits.

What do I need to add to this configuration to get the PowerPal bit working?

Obviously you can’t get an API key from PowerPal at this point so I would like to retrieve it from the device if I can.

I’m happy to buy some other ESP’s and I’m planning on it but I don’t have anything else but this one today and I was hoping I could add PowerPal in with the other bits:

substitutions:
name: “human_presence_powerpal”
friendly_name: “humanpowerpalsensor”
area: living
esphome:
name: “${name}”
friendly_name: “${friendly_name}”
name_add_mac_suffix: true
project:
name: “seeedstudio.mmwave_kit”
version: “3.0”
platformio_options:
board_build.flash_mode: dio
board_build.mcu: esp32c3

external_components:

  • source: github://limengdu/mmwave-kit-external-components@main
    refresh: 0s
    • 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 ]

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: DF:5C:55:00:00:00 ← I’m guessing my PowerPal MAC goes here?
    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: 123123
    notification_interval: 1 # get updates every 1 minute
    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.24 #dollars per kWh
    powerpal_device_id: 0000abcd #optional, component will retrieve from your Powerpal if not set
    powerpal_apikey: 4a89e298-b17b-43e7-a0c1-fcd1412e98ef #optional, component will retrieve from your Powerpal if not set

esp32:
board: esp32-c3-devkitm-1
variant: esp32c3
framework:
type: esp-idf

Enable logging

logger:
hardware_uart: USB_SERIAL_JTAG
level: DEBUG

Enable Home Assistant API

api:
encryption:
key: “XXXXXX”

ota:

  • platform: esphome
    password: “XXXXX”

wifi:
ssid: “SixG”
password: “XXXXXX”

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: “Mmwave-Sensor Fallback Hotspot”
password: “XXXXXX”

captive_portal:

Sets up Bluetooth LE (Only on ESP32) to allow the user

to provision wifi credentials to the device.

esp32_improv:
authorizer: none

Sets up the improv via serial client for Wi-Fi provisioning.

Handy if your device has a usb port for the user to add credentials when they first get it.

improv_serial: # Commented until improv works with usb-jtag on idf

Enable Bluetooth Low Energy (BLE) functionality

esp32_ble_tracker:

Enable Bluetooth Proxy functionality

bluetooth_proxy:
active: true

uart:
id: uart_bus
baud_rate: 115200
rx_pin: 4
tx_pin: 5
parity: NONE
stop_bits: 1

seeed_mr24hpc1:
id: my_seeed_mr24hpc1

text_sensor:

  • platform: seeed_mr24hpc1
    heart_beat:
    name: “Heartbeat”
    product_model:
    name: “Product Model”
    product_id:
    name: “Product ID”
    hardware_model:
    name: “Hardware Model”
    hardware_version:
    name: “Hardware Version”
    keep_away:
    name: “Active Reporting Of Proximity”
    motion_status:
    name: “Motion Information”
    custom_mode_end:
    name: “Custom Mode Status”

binary_sensor:

  • platform: seeed_mr24hpc1
    has_target:
    name: “Presence Information”

sensor:

  • platform: seeed_mr24hpc1
    custom_presence_of_detection:
    name: “Static Distance”
    movement_signs:
    name: “Body Movement Parameter”
    custom_motion_distance:
    name: “Motion Distance”
    custom_spatial_static_value:
    name: “Existence Energy”
    custom_spatial_motion_value:
    name: “Motion Energy”
    custom_motion_speed:
    name: “Motion Speed”
    custom_mode_num:
    name: “Current Custom Mode”

switch:

  • platform: seeed_mr24hpc1
    underlying_open_function:
    name: Underlying Open Function Info Output Switch

button:

  • platform: seeed_mr24hpc1
    restart:
    name: “Module Restart”
    custom_set_end:
    name: “End Of Custom Mode Settings”

select:

  • platform: seeed_mr24hpc1
    scene_mode:
    name: “Scene”
    unman_time:
    name: “Time For Entering No Person State (Standard Function)”
    existence_boundary:
    name: “Existence Boundary”
    motion_boundary:
    name: “Motion Boundary”

number:

  • platform: seeed_mr24hpc1
    sensitivity:
    name: “Sensitivity”
    custom_mode:
    name: “Custom Mode”
    existence_threshold:
    name: “Existence Energy Threshold”
    motion_threshold:
    name: “Motion Energy Threshold”
    motion_trigger:
    name: “Motion Trigger Time”
    motion_to_rest:
    name: “Motion To Rest Time”
    custom_unman_time:
    name: “Time For Entering No Person State (Underlying Open Function)”