Powerfox Poweropti YAML Code

Hallo zusammen, es tut mir sehr leid, ich bin neuling und sehr verzweifelt. Ich bin nicht in der Lage einen funktionierenden Code einzufügen. ich habe das ganze Netz durchsucht alles ausprobiert, aber mir werden einfach nicht die Entiäten der Sensoren angezeigt, egal was ich mache. Und schon gar nicht unter der Energie Reiter den Bezug einzubinden. Vielleicht mag mir jemand einen Tip geben.

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

homeassistant:
  customize: !include customize.yaml

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

# custom rest sensor for poweropti device
rest:
  - resource: https://backend.powerfox.energy/api/2/my/main/current?unit=kwh
    method: GET
    authentication: basic
    username: !secret poweropti_username
    password: !secret poweropti_password
    timeout: 10
    scan_interval: 30
    sensor:
      - name: "poweropti_cloud"
        unique_id: "poweropti-cloud"
        json_attributes:
          - "watt"
          - "timestamp"
          - "a_Plus"
          - "a_Plus_HT"
          - "a_Plus_NT"
          - "a_Minus"
          - "outdated"
      - name: "PowerOpti 1 Strom Aktuell"
        unique_id: "poweropti1-strom-aktuell"
        device_class: "power"
        state_class: "measurement"
        unit_of_measurement: "W"
        value_template: "{{ value_json.watt }}"
        availability: "{{ is_number(state_attr('sensor.poweropti_cloud', 'watt'))  and state_attr('sensor.poweropti_cloud', 'outdated') == false}}"
      - name: "PowerOpti 1 Strom Gesamt"
        unique_id: "poweropti1-strom-total"
        device_class: "energy"
        state_class: "total_increasing"
        unit_of_measurement: "kWh"
        value_template: "{{ value_json.a_Plus }}"
        availability: "{{ is_number(state_attr('sensor.poweropti_cloud', 'a_Plus')) and state_attr('sensor.poweropti_cloud', 'outdated') == false}}"
      - name: "PowerOpti 1 Einspeisung Gesamt"
        unique_id: "poweropti1-production-total"
        device_class: "energy"
        state_class: "total_increasing"
        unit_of_measurement: "kWh"
        value_template: "{{ value_json.a_Minus }}"
        availability: "{{ is_number(state_attr('sensor.poweropti_cloud', 'a_Minus')) and state_attr('sensor.poweropti_cloud', 'outdated') == false}}"

:crayon:by HarryP: Code-/Logzeilen formatiert (bitte immer in </> einbinden)

Mit der Version 2025.01 zieht FowerFox endlich als integration ein :wink:

Hallo Forum,
ich konnte den Poweropti, mit der Anleitung von Simon42, in mein HA einbinden.
Leider bekomme ich aber nur die Gesamtwerte meines Zählers angezeigt und nicht den aktuellen Verbrauch. Vielleicht kann mir jemand Helfen meinen Fehler zu finden. Schonmal vielen Dank im Voraus!

rest:
  - authentication: basic
    username: E-mail Adresse
    password: password
    scan_interval: 30
    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-EG-aktuell"
        unit_of_measurement: "W"
        device_class: "power"
        state_class: "measurement"
        state: >
          {{ state_attr('sensor.poweropti', 'Watt') }}
      - name: "Strom-EG-Bezug"
        unit_of_measurement: "kWh"
        device_class: "energy"
        state_class: "total_increasing"
        state: >
          {% set value = state_attr( 'sensor.poweropti', 'A_Plus') }
          {{value if value != 0 else none }}
      - name: "PV-Einspeisung"
        unit_of_measurement: "kWh"
        device_class: "energy"
        state_class: "total_increasing"
        state: >
          {% set value = state_attr('sensor.poweropti', 'A_Minus') }
          {{value if value != 0 else none}}

Bildschirmfoto 2024-12-25 um 17.49.02

Ich musste dafür damls an meinem neuen Stromzähler dn punkt Info Aktivieren damit auch Dezimalstellen mitgeliefert werden.

Zur Info ab 2025.1 ist Powerfox wahrscheinlich eine offizielle Integration, zumindest wird es schon in den Beta Release Notes genannt.

LG

2 „Gefällt mir“

Korrekt. Gerät Powerfox wurde nach Update auf 2025.1 erkannt.