Powerpal smart energy monitor

I got it working, but not using the code above. I had to modify and tweak and eventually got it to push to a fresh ESPHome device (https://amzn.to/3tZzMWl)

My steps were;

  1. Flash using Web - ESPHome and connect to WiFi
  2. Deploy standard Bluetooth Proxy in HA to pickup the MAC Address of the Powerpal device, as it was not on a sticker or on the original packaging. I used the below YAML to provision the ESP Device, in the ESPHome add-on.
esphome:
  name: esphome-web-bb7d28 #THE NAME OF YOUR ESP Device
  friendly_name: Bluetooth Proxy #THE FRIENDLY NAME YOU WOULD LIKE

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

# Enable this block to pickup local BLE devices in the ESPHome Device Logs
text_sensor: 
  - platform: ble_scanner
    name: "BLE Devices Scanner"

bluetooth_proxy:
  active: true
  1. Once deployed, the log will report local BLE devices, and their MAC address, including the Powerpal.
  2. Deploy the below code on the ESP Home device replacing the bluetooth proxy. In my case i have 2 so i kept one as a bluetooth proxy and setup the below code on the ESP i wanted to act as the Powerpal relay
substitutions:
  device_name: esphome-web-2a46e0 #THE NAME OF YOUR ESP Device
  friendly_name: Powerpal Gateway #THE FRIENDLY NAME OF YOUR ESP Device

esphome:
  name: ${device_name}
  platform: ESP32
  board: "esp32dev"
  on_boot:
    then:
      - lambda: |-
           powerpal_ble_powerpal->daily_pulses_ = id(powerpal_daily_pulses_backup) ;

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

logger:
 level: DEBUG

api:

ota:

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


time:
  - platform: homeassistant
    id: homeassistant_time

esp32_ble_tracker:

ble_client:
  - mac_address: XX:XX:XX:XX:XX:XX #PUT YOUR MAC ADDRESS HERE - NO QUOTES IS IMPORTANT
    id: powerpal

switch:
  - platform: restart
    name: "Powerpal Monitor Reboot"

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

sensor:
  - platform: powerpal_ble
    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: 000000 #PUT THE PAIRING CODE FOUND WITH YOUR POWERPAL HERE
    notification_interval: 1
    pulses_per_kwh: 1000
    #http_request_id: powerpal_cloud_uploader
    time_id: homeassistant_time # daily energy still works without a time_id, but recommended to include one to properly handle daylight savings, etc.
    #cost_per_kwh: 0.30 #dollars per kWh

  - 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);'
  1. Once the above was deployed on the ESP i started to receive data in the entities. Important is to note that the MAC address and the pairing code should not be in quotes - they should be bare, if you put them in quotes, it compiles but doesn’t work
  2. I then used the “Powerpal Total Energy” entity in the energy screen and it took about 2 hours for data to start showing correctly.

It’s important to get the name right, to match the esphome-web-XXXXX name when provisioned as this is the name it looks up to find the IP of the device to deploy - for simplicity, keep this the same, and change the friendly name only - i now get flawless deployments.

2 Likes