Open benh-au opened 1 year ago
Same issues for me plus a couple of others
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
I have same issue: I'm trying to compile powerpal config in ESPHOME using latest version 2023.2.1 I've re-downloaded/installed latest version of powerpal.
Powerpal works with previous versions, but HA has deprecated "AP password" for "AP KEY" and all my ESPHome devices need updating.
YAML
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: d5:d7:12:xx:xxx:xx
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: 667124
notification_interval: 1
pulses_per_kwh: 800
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: 0000d32e #optional, component will retrieve from your Powerpal if not set
powerpal_apikey: 1ea7e8b2-4a8f-4e20-8e61-xxxxxxxxxxxx #optional, component will retrieve from your Powerpal if not set
Compilation Logs
Processing somfy (board: nodemcu-32s; framework: arduino; platform: platformio/espressif32 @ 5.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- SPI @ 2.0.0
|-- EEPROM @ 2.0.0
|-- SmartRC-CC1101-Driver-Lib @ 2.5.7
|-- Somfy_Remote_Lib @ 0.4.1
|-- WiFi @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- Update @ 2.0.0
|-- ArduinoJson @ 6.18.5
|-- WiFiClientSecure @ 2.0.0
|-- HTTPClient @ 2.0.0
Compiling /data/somfy/.pioenvs/somfy/src/esphome/components/ble_client/ble_client.cpp.o
Compiling /data/somfy/.pioenvs/somfy/src/esphome/components/json/json_util.cpp.o
Compiling /data/somfy/.pioenvs/somfy/src/esphome/components/logger/logger.cpp.o
Compiling /data/somfy/.pioenvs/somfy/src/esphome/components/md5/md5.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:157: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,
^~~~~~~~~~~~~~~~~~~
*** [/data/somfy/.pioenvs/somfy/src/esphome/components/ble_client/ble_client.cpp.o] Error 1
========================== [FAILED] Took 3.68 seconds ==========================
The fork created by @muneeb1990 (https://github.com/muneeb1990/esphome/tree/powerpal_ble/esphome/components/powerpal_ble) seems to solve this problem. However, do not use a local ble_client in the external components.
Same compile problem for me and sadly this is the first time I have used ESPHome so no clue how to fix it!
@CV8R I solved the problem by doing the following: Instead of pulling the code for the external components from weekendwarrior’s Github site you create the external components for powerpal_ble locally in Home-Assistant by: Under config/esphome folder create a folder called ‘my_components’. Inside ‘my_components’ create another folder called ‘powepal_ble’ Then download the files referred to by @muneeb1990. To download files from Github you have to view the file and then click the ‘RAW’ button. You can either copy and paste the RAW data into a file created in Home-Assistant, or save the file on you local computer and transfer it using SAMBA NOTE: confusingly the init.py file is empty but must be in the powerpal_ble folder. Now change the powerpal-gateway.yaml file to reference the external components locally by putting the following into the ESPhome config folder:
external_components:
- source:
type: local
path: my_components
components: [powerpal_ble, http_request]
I hope this helps
@HSB-collab Thanks. Invaluable info and can confirm it works well with Home Assistant in 2024.
@HSB-collab Thanks. Invaluable info and can confirm it works well with Home Assistant in 2024.
Actually @KmanOz there is a better solution because @muneeb1990 has put the solution on his github site due to another breaking change - see https://community.home-assistant.io/t/powerpal-smart-energy-monitor/263713/312. To quote from this thread: "You can now replace the external_components section of yaml file with: external_components:
Actually @KmanOz there is a better solution because @muneeb1990 has put the solution on his github site due to another breaking change - see https://community.home-assistant.io/t/powerpal-smart-energy-monitor/263713/312.
Confirmed that this worked for me and ESPHome compiled.
Hi @muneeb1990, I noticed your code does not contain the code for uploading the data to powerpal. However, this facility is available in @WeekendWarrior1's code. Any reason why this was not done?
I tried to copy parts of the code from @WeekendWarrior1 to yours. But it didn't work.
Code I'm using: Powerpal app still works (make sure phone isn't connected to PP device)
ble_client:
- mac_address: <my pp mac address>
id: powerpal
globals:
- id: powerpal_daily_pulses_backup
type: int
restore_value: true
http_request:
id: powerpal_cloud_uploader
verify_ssl: false
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"
#watt_hours:
# name: "Powerpal Average Watts within interval"
pairing_code: <pairing code>
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.
cost_per_kwh: 0.3145 #dollars per kWh
powerpal_device_id: <device id> #optional, component will retrieve from your Powerpal if not set
powerpal_apikey: <api key> #optional, component will retrieve from your Powerpal if not set
- 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);'
preferences:
flash_write_interval: 10min
In home assistant, I have Automation:
alias: Powerpal Cloud Upload
description: Powerpal cloud upload
trigger:
- platform: time_pattern
minutes: /1
condition: []
action:
- service: rest_command.my_request
data: {}
mode: single
This seems to work. NB: uploader needs to be every 60 seconds
What's the rest command?
Using the example powerpal_ble.yaml, and ESPHome v2012.12.3 (simply changing the board from "wemos_d1_mini32" to "esp32dev")- the Install compilation consistently fails with errors relating to the ble_tracker.cpp component and in incompatible return type.
ESPHome yaml file and compile log are attached.
Is this a possibly a breaking change in the ESPHome core framework since your powerpal_ble component was devised? I'm sorry that I'm new to ESPHome custom components and framework source code, so I can only report to you what I'm encountering - not sure what code changes might resolve these errors.
Compile Log: logs_powerpalble-3e5538_compile_errors.txt YAML File: powerpalble-3e5538_yaml.txt