Guten Tag,
ich habs fast geschafft aber leider komme ich nun nicht weiter.
In meinem Gartenhaus haben wir ein BKW installiert, der Raspi ist zuhause und soll die Werte abfragen und im Energiedashbord anzeigen.
hier mal meine config
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
rest:
- resource: "https://shelly-57-eu.shelly.cloud/device/status?id=xxx&auth_key=xxx"
method: GET
scan_interval: 10
headers:
User-Agent: HomeAssistant
Content-Type: application/x-www-form-urlencoded
sensor:
- name: 3em-power1
unique_id: SteiniPower1
value_template: "{{ value_json.data.device_status['em:0'].a_act_power }}"
state_class: measurement
unit_of_measurement: W
device_class: power
- name: 3em-power2
unique_id: SteiniPower2
value_template: "{{ value_json.data.device_status['em:0'].b_act_power }}"
state_class: measurement
unit_of_measurement: W
device_class: power
- name: 3em-power3
unique_id: SteiniPower3
value_template: "{{ value_json.data.device_status['em:0'].c_act_power }}"
state_class: measurement
unit_of_measurement: W
device_class: power
- name: 3em-Strom1
unique_id: SteiniStrom1
value_template: "{{ value_json.data.device_status['em:0'].a_current }}"
state_class: measurement
unit_of_measurement: A
device_class: power
- name: 3em-Strom2
unique_id: SteiniStrom2
value_template: "{{ value_json.data.device_status['em:0'].b_current }}"
state_class: measurement
unit_of_measurement: A
device_class: power
- name: 3em-Strom3
unique_id: SteiniStrom3
value_template: "{{ value_json.data.device_status['em:0'].c_current }}"
state_class: measurement
unit_of_measurement: A
device_class: power
- name: 3em-StromGesamt
unique_id: SteiniStromGesamt
value_template: "{{ value_json.data.device_status['em:0'].total_current }}"
state_class: measurement
unit_of_measurement: A
device_class: power
- name: 3em-PowerGesamt
unique_id: SteiniPowerGesamt
value_template: "{{ value_json.data.device_status['em:0'].total_act_power }}"
state_class: measurement
unit_of_measurement: W
device_class: power
#rest:
- resource: "https://shelly-57-eu.shelly.cloud/device/status?id=xxx&auth_key=xxx"
method: GET
scan_interval: 5
headers:
User-Agent: Home Assistant
Content-Type: application/x-www-form-urlencoded
sensor:
- name: SteiniBKW
unique_id: SteiniPowerBKW
value_template: "{{ value_json.data['device_status']['switch:0']['apower'] }}"
state_class: measurement
unit_of_measurement: W
device_class: power
Um den Netzbezug und die Einspeisung zu berechnen habe ich versucht 2 Sensoren anzulegen, aber das klappt nicht, sie werden nicht angezeigt.
template:
- sensor:
###########
# Berechnung Netzbezug in W
###########
- name: "power_import"
unit_of_measurement: 'W'
device_class: power
state_class: measurement
state: >-
{% if (states('sensor.3em-PowerGesamt'))|float(0) > 0 %}
{{ states('sensor.3em-PowerGesamt'))|float(0) }}
{% else %}
{{ 0 }}
{% endif %}
availability: "{{
[ states('sensor.gesamt_strom')
] | map('is_number') | min
}}"
###########
# Berechnung Einspeißung in W
###########
- name: "power_export"
unit_of_measurement: 'W'
device_class: power
state_class: measurement
state: >-
{% if (states('sensor.3em-PowerGesamt'))|float(0) < 0 %}
{{ (states('sensor.3em-PowerGesamt'))|float(0) * -1 }}
{% else %}
{{ 0 }}
{% endif %}
availability: "{{
[ states('sensor.gesamt_strom')
] | map('is_number') | min
}}"
Die anderen angelegten Sensoren werden angezeigt.
Kann mir jemand weiterhelfen, danke.