# Fronius Solar-API "Basic" Integration by gapsed.com
# Bitte einfügen in /gapsed/
# Passe ggf. die Entity-Namen unten (sensor.solarnet_...) an deine an

template:
  - sensor:
      - name: "Speicher Ladeleistung"
        unique_id: speicher_ladeleistung
        device_class: power
        state_class: measurement
        unit_of_measurement: W
        icon: mdi:battery-charging
        state: "{{ max(0, states('sensor.solarnet_ladeleistung') | float(0)) }}" #prüfe Entity-Name

      - name: "Speicher Entladeleistung"
        unique_id: speicher_entladeleistung
        device_class: power
        state_class: measurement
        unit_of_measurement: W
        icon: mdi:battery-arrow-down
        state: "{{ max(0, states('sensor.solarnet_entladeleistung') | float(0)) }}" #prüfe Entity-Name

      - name: "PV Leistung"
        unique_id: pv_leistung
        device_class: power
        state_class: measurement
        unit_of_measurement: W
        icon: mdi:solar-power
        state: "{{ states('sensor.solarnet_pv_leistung') | float(0) }}" #prüfe Entity-Name

sensor:
  - platform: integration
    source: sensor.speicher_ladeleistung
    name: "Energie Speicher (Ladung)"
    unique_id: energie_speicher_ladung
    unit_prefix: k
    unit_time: h
    round: 3
    method: left

  - platform: integration
    source: sensor.speicher_entladeleistung
    name: "Energie Speicher (Entladung)"
    unique_id: energie_speicher_entladung
    unit_prefix: k
    unit_time: h
    round: 3
    method: left

  - platform: integration
    source: sensor.pv_leistung
    name: "PV Energie gesamt"
    unique_id: pv_energie_gesamt
    unit_prefix: k
    unit_time: h
    round: 3
    method: left