Skip to content

Instantly share code, notes, and snippets.

@user-x-adm
Last active January 2, 2025 18:31
Show Gist options
  • Save user-x-adm/38ca8b9ad413a4d961305c7b1b8dda69 to your computer and use it in GitHub Desktop.
Save user-x-adm/38ca8b9ad413a4d961305c7b1b8dda69 to your computer and use it in GitHub Desktop.
HA-configuration-yaml-powerfox
# put this in your configuration.yaml to get sensor data from powerfox.de
rest:
- authentication: basic
username: !secret ovag-user
password: !secret ovag-pw
scan_interval: 15
resource: https://backend.powerfox.energy/api/2.0/my/main/current?unit=kwh
sensor:
- name: "poweropti"
json_attributes:
- "Watt"
- "Timestamp"
- "A_Plus"
- "A_Minus"
- "Outdated"
template:
- sensor:
- name: "Strom-OVAG-aktuell"
unit_of_measurement: "W"
device_class: "power"
state_class: "measurement"
unique_id: "strom_aktuell"
state: >
{{ state_attr('sensor.poweropti', 'Watt') }}
- name: "Strom-OVAG-Bezug"
unit_of_measurement: "kWh"
device_class: "energy"
state_class: "total_increasing"
unique_id: "strom_bezug_kwh
state: >
{{ state_attr('sensor.poweropti', 'A_Plus') }}
- name: "Strom-OVAG-Netz-Lieferung"
unit_of_measurement: "kWh"
device_class: "energy"
state_class: "total_increasing"
unique_id: "strom_lieferung_kwh"
state: >
{{ state_attr('sensor.poweropti', 'A_Minus') }}
#
@user-x-adm
Copy link
Author

user-x-adm commented Jun 15, 2022

Powerfox Integration in Home Assistant (HA) --- HASS

  1. put your powerfox (poweropti) credentials in /config/secrets.yaml - like this

ovag-user: your-e-mail
ovag-pw: your-pw

  1. copy & paste this code in your configuration.yaml of Home Assistant, adjust the statements for username, pw ...

DE:
Eure Zugangsdaten zu Powerfox packt ihr am besten in die /config/secrets.yaml
Falls iher andere Key-Wörter benutzt müsst ihr das in der configuration.yaml entsprechend anpassen
weitere Infos hier:
https://www.it-und-hausautomation-blog.de/energie-dashboard/

@achim-Ru
Copy link

Hallo,

The configuration.yaml only integrates the main counter (as the reference/delivery counter). How do I add the second Poweropti, which sits on the PV production counter, to the configuration.yaml?

Thanks

@user-x-adm
Copy link
Author

user-x-adm commented Oct 11, 2022

I dont use Poweropti for the PV prod, because I use a solarlog sensor, integrated (solarlog integration) with HomeAssistant, for this.
It might be also an option to use a meter sensor as I mentioned in this blog post.
https://www.it-und-hausautomation-blog.de/energie-dashboard/
But if you want to use a second poweropti then you have to use a different URL of the API - pls check the API docu of Powerfox.
The yaml syntax is similar to this example.

@derklausi
Copy link

Powerfox Integration in Home Assistant (HA) --- HASS

1. put your powerfox (poweropti) credentials in /config/secrets.yaml - like this

ovag-user: your-e-mail ovag-pw: your-pw

2. copy & paste this code in your configuration.yaml of Home Assistant, adjust the statements for username, pw ...

DE: Eure Zugangsdaten zu Powerfox packt ihr am besten in die /config/secrets.yaml Falls iher andere Key-Wörter benutzt müsst ihr das in der configuration.yaml entsprechend anpassen weitere Infos hier: https://www.it-und-hausautomation-blog.de/energie-dashboard/

Hi, thank you so far. Is this still working after the last update? As i remember they changed something for Azure Cloud...
Do i need to add more Information if i have more than 1 Device? (I have a Poweropti and one more for my Water-Clock)
I added the Script and secrets and don't get any values back.

@user-x-adm
Copy link
Author

Yes, it still works fine on my HA. Yes you need more (different) configuration in case of more than 1 device.
You should have a look at the powerfox api docu in order to configure the configuration.yaml

docu in german: https://www.powerfox.energy/wp-content/uploads/2020/05/powerfox-Kunden-API.pdf

like:
First: Open a browser and send https://backend.powerfox.energy/api/2.0/my/all/devices
You will ask for your credentials....

you will get back a information like:
[{"DeviceId":"XXXXX","AccountAssociatedSince":YYYYY,"MainDevice":true,"Prosumer":true,"Division":0}]
... in the case of one device. In the case of more devices you should get a list of devices
BTW Division 0 means Power, 1 means water

Example for your power meter: You have to use the following URL
https://backend.powerfox.energy/api/2.0/my/XXXX/current?unit=kwh

  • replace the XXXX with your device id, which you got with the first call

This should work for the power meter.
You have to add a similar config for your water meter.

@user-x-adm
Copy link
Author

For the water meter you should try:
https://backend.powerfox.energy/api/2.0/my/XXXX/current

If you send me the feedback on this request I could try to write the config code.
But first you should try to get the power meter up and running with HA ;-)

@user-x-adm
Copy link
Author

I have added the "unique_id:" Based on this configuration, you can change some settings of this sensor in the GUI/dashboard.

@CrowCounter77
Copy link

Nice: chatGPT found the missing " after unique_id: "strom_bezug_kwh for me

;-)

@Trinity762
Copy link

Hello, unfotunately it does not work for me. What do i need to fill in besides my account details? How do i get the unique ID for the sensors?
Leider funktioniert das bei mir nicht. Die Powerfox app läuft normal. Jemand ne Idee?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment