@markcs I am using your solution to get data from the PowerPal meter_reading API endpoint. I noticed the data is only kept in windows of 15 minutes. I was able to get a reading every minute so far using the following
resource_template: https://readings.powerpal.net/api/v1/meter_reading/<device_id>?start={{ (as_timestamp(now()) - 960) | int }}&end={{ (as_timestamp(now()) - 900) | int }}&sample=1
This gives a single entry for the 1 minute window. The only problem is that it’s 15 minutes in the past. When using HA graphs it shows it 15 minutes in the future so I have used Grafana/mariadb to create the graph below using the timestamp from the powerpal data. Thank’s for the info btw.
Here’s the SQL I used to push the graph data back 15 minutes using grafana/mariadb. The negative number I used (-39580) is more then 15 minutes in my query as he mariadb instance I am using has a different timezone to the powerpal timestamp.
SELECT
FROM_UNIXTIME(JSON_EXTRACT(attributes,"$.timestamp")-39580) as "time",
"PowerPal (1min)" AS "metric",
CAST(JSON_EXTRACT(attributes,"$.watt_hours") AS FLOAT) * 60 as "value"
FROM states
WHERE JSON_EXTRACT(attributes,"$.watt_hours") != ""
AND JSON_EXTRACT(attributes,"$.timestamp") BETWEEN SUBSTR($__from,1,10) AND SUBSTR($__to,1,10)
IMPORTANT NOTICE
Connecting third party applications to Powerpal directly over BLE is not (and will never be) supported due to potential data security risks. Any attempt to connect to Powerpal directly over BLE and retrieve data may trigger anti-tamper measures which would render your Powerpal inoperable, as well as voiding the warranty.
Today I received an email from PowerPal regarding the beta testing program for their wifi based hub.
I’ve since registered, has anyone else received the same email?
Question… I have powerpal app on a galaxy tablet. Used the app to set up the pro which now has a green light on it. How do I then connect my phone to it so I can have app on both phone and tablet? Every time i try and connect my phone, it asks to connect to bluetooth but can’t because I already have the tablet connected to it. Confusing as.
I don’t think the dashboard accommodates live consumption. You want the kwh measure for the dashboard. You can break out individual components as detailed below and create your own view. That could the include live consumption. I use a gauge card separately to the dashboard.
It only allows connection to one device, plus the app must always be running. I’d stick with the tablet because you would probably take your phone with you when you leave the house which would result in no data for the period you’re gone.
For anyone interested I have reverse engineered and documented the Powerpal BLE API, and put together a simple sketch for an ESP32 to connect and print out Powerpal energy updates:
I have also reverse engineered the Emerald Electricity Advisor BLE API (and the Emerald Cloud API):
Next steps are to create esphome components for them both (Powerpal will likely come first as it’s authentication process is simpler)
It’s not PR’d to ESPhome yet, but you can use it via external_components like this:
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 ]
# 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
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 # 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.1872 #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
What it looks like in Home Assistant:
(Powerpal Total Energy is used to integrate the usage into the HA Energy Dashboard)
The component still needs a bit of a cleanup and extra features but I hope some people find it useful.
I have now also finished the Emerald Electricity Advisor ESPHome component if anyone has one of these instead of the Powerpal:
Just like the Powerpal component, it’s not PR’d to ESPhome yet, but you can use it via external_components like this:
external_components:
external_components:
- source: github://WeekendWarrior1/esphome@emerald_ble
# requires ble_client and ble_tracker because I had to add some small features to authenticate properly
components: [ ble_client, esp32_ble_tracker, emerald_ble ]
# optional requirement used with daily energy sensor
time:
- platform: homeassistant
id: homeassistant_time
esp32_ble_tracker:
ble_client:
- mac_address: 30:1B:97:01:02:03
id: emerald_advisor
sensor:
- platform: emerald_ble
ble_client_id: emerald_advisor
power:
name: "Emerald Power"
daily_energy:
name: "Emerald Daily Energy"
energy:
name: "Emerald Total Energy"
battery_level:
name: "Emerald Battery"
pairing_code: 123123
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.
What it looks like in Home Assistant:
(Like above, Emerald Total Energy is used to integrate the usage into the HA Energy Dashboard)
Also like above, the component still needs a bit of a cleanup and extra features but I hope some people find it useful.
A little bit more documentation is in the readme: