Completely new Energy monitoring, with cumulative import, export and consumption.
This commit is contained in:
parent
0191bc13b7
commit
4d2c5b0cba
@ -38,26 +38,7 @@ utility_meter: !include utility_meters.yaml
|
||||
mqtt: !include mqtt.yaml
|
||||
|
||||
# Template sensors
|
||||
template:
|
||||
- sensor:
|
||||
- name: "Leckstrom"
|
||||
unit_of_measurement: "W"
|
||||
icon: mdi:flash
|
||||
state: >
|
||||
{% set total = states('sensor.netzleistung') | float %}
|
||||
{% set solar = states('sensor.balkonkraftwerk_power') | float %}
|
||||
{% set raumduft = states('sensor.flur_raumduft_power') | float %}
|
||||
{% set keller = states('sensor.keller_power') | float %}
|
||||
{% set anrichte = states('sensor.kuche_anrichte_power') | float %}
|
||||
{% set musik = states('sensor.kuche_musik_power') | float %}
|
||||
{% set bett = states('sensor.schlafzimmer_bett_power') | float %}
|
||||
{% set heimkino_sz = states('sensor.schlafzimmer_heimkino_power') | float %}
|
||||
{% set deko = states('sensor.schreibtisch_deko_power') | float %}
|
||||
{% set schreibtisch = states('sensor.schreibtisch_power') | float %}
|
||||
{% set serverraum = states('sensor.serverraum_power') | float %}
|
||||
{% set heimkino_wz = states('sensor.wohnzimmer_heimkino_power') | float %}
|
||||
{% set spieleschrank = states('sensor.wohnzimmer_spieleschrank_power') | float %}
|
||||
{{ (total + solar - raumduft - keller - musik - bett - heimkino_sz - deko - schreibtisch - serverraum - heimkino_wz - spieleschrank) | round(1) }}
|
||||
template: !include template.yaml
|
||||
|
||||
# calendar integration
|
||||
calendar: !include calendars.yaml
|
||||
|
23
sensors.yaml
23
sensors.yaml
@ -69,3 +69,26 @@
|
||||
friendly_name: "Sun Setting Template"
|
||||
value_template: "{{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom ('%H:%M') }}"
|
||||
|
||||
# Sensor for Riemann sum of energy import (W -> Wh)
|
||||
- platform: integration
|
||||
source: sensor.power_import
|
||||
name: energy_import_sum
|
||||
unit_prefix: k
|
||||
round: 2
|
||||
method: left
|
||||
|
||||
# Sensor for Riemann sum of energy export (W -> Wh)
|
||||
- platform: integration
|
||||
source: sensor.power_export
|
||||
name: energy_export_sum
|
||||
unit_prefix: k
|
||||
round: 2
|
||||
method: left
|
||||
|
||||
# Sensor for Riemann sum of energy consumption (W -> Wh)
|
||||
- platform: integration
|
||||
source: sensor.power_consumption
|
||||
name: energy_consumption_sum
|
||||
unit_prefix: k
|
||||
round: 2
|
||||
method: left
|
||||
|
71
template.yaml
Normal file
71
template.yaml
Normal file
@ -0,0 +1,71 @@
|
||||
- sensor:
|
||||
- name: "power_other"
|
||||
unit_of_measurement: "W"
|
||||
icon: mdi:flash
|
||||
state: >
|
||||
{% set total = states('sensor.netzleistung') | float %}
|
||||
{% set solar = states('sensor.balkonkraftwerk_power') | float %}
|
||||
{% set raumduft = states('sensor.flur_raumduft_power') | float %}
|
||||
{% set keller = states('sensor.keller_power') | float %}
|
||||
{% set anrichte = states('sensor.kuche_anrichte_power') | float %}
|
||||
{% set musik = states('sensor.kuche_musik_power') | float %}
|
||||
{% set bett = states('sensor.schlafzimmer_bett_power') | float %}
|
||||
{% set heimkino_sz = states('sensor.schlafzimmer_heimkino_power') | float %}
|
||||
{% set deko = states('sensor.schreibtisch_deko_power') | float %}
|
||||
{% set schreibtisch = states('sensor.schreibtisch_power') | float %}
|
||||
{% set serverraum = states('sensor.serverraum_power') | float %}
|
||||
{% set heimkino_wz = states('sensor.wohnzimmer_heimkino_power') | float %}
|
||||
{% set spieleschrank = states('sensor.wohnzimmer_spieleschrank_power') | float %}
|
||||
{{ (total + solar - raumduft - keller - musik - bett - heimkino_sz - deko - schreibtisch - serverraum - heimkino_wz - spieleschrank) | round(1) }}
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
attributes:
|
||||
last_reset: '1970-01-01T00:00:00+00:00'
|
||||
|
||||
# Shelly 3EM cumulative sensors (incl. PV)
|
||||
- sensor:
|
||||
# Template sensor for values of power import (active_power > 0)
|
||||
- name: power_import
|
||||
unit_of_measurement: 'W'
|
||||
state: >
|
||||
{% if (states('sensor.line_power_channel_a_power')|float + states('sensor.line_power_channel_b_power')|float + states('sensor.line_power_channel_c_power')|float) > 0 %}
|
||||
{{ states('sensor.line_power_channel_a_power')|float + states('sensor.line_power_channel_b_power')|float + states('sensor.line_power_channel_c_power')|float }}
|
||||
{% else %}
|
||||
{{ 0 }}
|
||||
{% endif %}
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
icon: mdi:transmission-tower-export
|
||||
attributes:
|
||||
last_reset: '1970-01-01T00:00:00+00:00'
|
||||
|
||||
# Template sensor for values of power export (active_power < 0)
|
||||
- name: power_export
|
||||
unit_of_measurement: 'W'
|
||||
state: >
|
||||
{% if (states('sensor.line_power_channel_a_power')|float + states('sensor.line_power_channel_b_power')|float + states('sensor.line_power_channel_c_power')|float) < 0 %}
|
||||
{{ (states('sensor.line_power_channel_a_power')|float + states('sensor.line_power_channel_b_power')|float + states('sensor.line_power_channel_c_power')|float) * -1 }}
|
||||
{% else %}
|
||||
{{ 0 }}
|
||||
{% endif %}
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
icon: mdi:transmission-tower-import
|
||||
attributes:
|
||||
last_reset: '1970-01-01T00:00:00+00:00'
|
||||
|
||||
# Template sensor for values of power consumption
|
||||
- name: power_consumption
|
||||
unit_of_measurement: 'W'
|
||||
state: >
|
||||
{% if (states('sensor.power_export')|float(0)) > 0 and (states('sensor.balkonkraftwerk_power')|float(0) - states('sensor.power_export')|float(0)) < 0 %}
|
||||
{% elif (states('sensor.power_export')|float(0)) > 0 and (states('sensor.balkonkraftwerk_power')|float(0) - states('sensor.power_export')|float(0)) > 0 %}
|
||||
{{ (states('sensor.balkonkraftwerk_power')|float(0)) - states('sensor.power_export')|float(0) }}
|
||||
{% else %}
|
||||
{{ states('sensor.power_import')|float(0) + states('sensor.balkonkraftwerk_power')|float(0) }}
|
||||
{% endif %}
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
icon: mdi:home-lightning-bolt
|
||||
attributes:
|
||||
last_reset: '1970-01-01T00:00:00+00:00'
|
@ -1,3 +1,4 @@
|
||||
# Internet traffic
|
||||
internet_usage_in_monthly:
|
||||
source: sensor.snmp_wan_in
|
||||
name: Monthly internet traffic in
|
||||
@ -22,3 +23,29 @@
|
||||
source: sensor.snmp_wan_out
|
||||
name: Hourly internet traffic out
|
||||
cycle: hourly
|
||||
|
||||
# Energy
|
||||
energy_import_daily:
|
||||
source: sensor.energy_import_sum
|
||||
name: Energy Import Daily
|
||||
cycle: daily
|
||||
energy_import_monthly:
|
||||
source: sensor.energy_import_sum
|
||||
name: Energy Import Monthly
|
||||
cycle: monthly
|
||||
energy_export_daily:
|
||||
source: sensor.energy_export_sum
|
||||
name: Energy Export Daily
|
||||
cycle: daily
|
||||
energy_export_monthly:
|
||||
source: sensor.energy_export_sum
|
||||
name: Energy Export Monthly
|
||||
cycle: monthly
|
||||
energy_consumption_daily:
|
||||
source: sensor.energy_consumption_sum
|
||||
name: Energy Consumption Daily
|
||||
cycle: daily
|
||||
energy_consumption_monthly:
|
||||
source: sensor.energy_consumption_sum
|
||||
name: Energy Consumption Monthly
|
||||
cycle: monthly
|
||||
|
Loading…
Reference in New Issue
Block a user