homeassistant/packages/electricity.yaml
2025-11-03 14:29:43 +01:00

168 lines
5.9 KiB
YAML

input_number:
# výkupní cena
electricity_sell_price:
name: "Electricity Sell Price"
icon: mdi:cash-plus
step: 0.1
min: 0
max: 10
unit_of_measurement: CZK/kWh
# Nákupní cena - nízký tarif + distribuce + Systémové služby + Daň z elektřiny
electricity_buy_price_nt:
name: "Electricity Buy Price NT"
icon: mdi:cash-minus
#initial: 2855.23
min: 0
max: 10000
step: 0.01
mode: box
unit_of_measurement: CZK/MWh
# Nákupní cena - vysoký tarif + distribuce + Systémové služby + Daň z elektřiny
electricity_buy_price_vt:
name: "Electricity Buy Price VT"
icon: mdi:cash-minus
#initial: 3370.67
min: 0
max: 10000
step: 0.01
mode: box
unit_of_measurement: CZK/MWh
# Stálý měsíční plat - poplpatek + provoz nesíťové infrastruktury + jistič 3x25 A
electricity_fix_month:
name: "Electricity Price Monthly Fee"
icon: mdi:cash-sync
#initial: 578.84
min: 0
max: 1000
step: 0.01
mode: box
unit_of_measurement: CZK/Month
template:
- binary_sensor:
# Spínání HDO - nízký tarif
- name: "Electricity HDO NT"
unique_id: electricity_hdo_nt
icon: mdi:transmission-tower
state: >-
{% set vt_hours = [10, 12, 14, 17] %}
{% set now = now() %}
{% if now.hour not in vt_hours %}
{{ true }} {# Nízký tarif #}
{% else %}
{{ false }} {# Vysoký tarif #}
{% endif %}
- sensor:
# Stav HDO - VT/NT
- name: "Electricity HDO"
unique_id: electricity_hdo
icon: mdi:transmission-tower
state: >
{% if is_state("binary_sensor.electricity_hdo_nt", "on") %}
{{ "NT" }} {# Nízký tarif #}
{% else %}
{{ "VT" }} {# Vysoký tarif #}
{% endif %}
# Aktuální nákupní cena elektřiny - VT/NT
- name: "Electricity Buy Price"
unique_id: electricity_buy_price
unit_of_measurement: "CZK/kWh"
state_class: measurement
icon: mdi:cash-minus
state: >
{% set price_vt = states('input_number.electricity_buy_price_vt')|float / 1000 %}
{% set price_nt = states('input_number.electricity_buy_price_nt')|float / 1000 %}
{% set vat = 21 %}
{% if is_state("binary_sensor.electricity_hdo_nt", "on") %}
{{ (price_nt|float * (1 + vat / 100)) | round(2) }} {# Nízký tarif #}
{% else %}
{{ (price_vt|float * (1 + vat / 100)) | round(2) }} {# Vysoký tarif #}
{% endif %}
# Stálý měsíční plat
- name: "Electricity Standing Charge"
unique_id: electricity_standing_charge
state: "0"
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
# Shelly3EM
- name: "Shelly3EM Energy Total"
unique_id: shelly3em_energy_total
icon: mdi:lightning-bolt
availability: >-
{{ states('sensor.shelly3em_phase_a_energy') not in ['0', 'unknown', 'unavailable', 'none'] and
states('sensor.shelly3em_phase_b_energy') not in ['0', 'unknown', 'unavailable', 'none'] and
states('sensor.shelly3em_phase_c_energy') not in ['0', 'unknown', 'unavailable', 'none'] }}
state: >-
{{ (states('sensor.shelly3em_phase_a_energy')|float +
states('sensor.shelly3em_phase_b_energy')|float +
states('sensor.shelly3em_phase_c_energy')|float) | round(2) }}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
- name: "Shelly3EM Power Total"
unique_id: shelly3em_power_total
icon: mdi:flash
state: >-
{{ (states('sensor.shelly3em_phase_a_power')|float +
states('sensor.shelly3em_phase_b_power')|float +
states('sensor.shelly3em_phase_c_power')|float) | round(2) }}
unit_of_measurement: W
device_class: power
state_class: measurement
# TUV
- name: "TUV Energy Total"
unique_id: tuv_energy_total
icon: mdi:lightning-bolt
availability: >-
{{ states('sensor.bathroom_boiler_plug_energy') not in ['0', 'unknown', 'unavailable', 'none'] and
states('sensor.fvetuv_feedback_energy') not in ['0', 'unknown', 'unavailable', 'none'] }}
state: >-
{{ (states('sensor.bathroom_boiler_plug_energy')|float +
states('sensor.fvetuv_feedback_energy')|float) | round(2) }}
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
- name: "TUV Power Total"
unique_id: tuv_power_total
icon: mdi:flash
state: >-
{{ (states('sensor.bathroom_boiler_plug_power')|float +
states('sensor.fvetuv_feedback_power')|float) | round(2) }}
unit_of_measurement: W
device_class: power
state_class: measurement
- name: "TUV Heater"
unique_id: tuv_heater
icon: mdi:water-boiler-auto
state: >-
{% set tuv2kw = states('sensor.bathroom_boiler_plug_power') %}
{% set tuv4kw = states('sensor.fvetuv_feedback_power') %}
{% if is_number(tuv2kw) and tuv2kw|float > 0 %}
{{ "1f.2kW" }} {# distribuce #}
{% elif is_number(tuv4kw) and tuv4kw|float > 0 %}
{{ "3f.4kW" }} {# přetok fve #}
{% else %}
{{ "-" }}
{% endif %}
- trigger:
- trigger: time_pattern
hours: "/1"
sensor:
- name: Electricity Fixed Hourly Charge
unique_id: electricity_fixed_hourly_charge
icon: mdi:cash-minus
state: >-
{% set hours = ((as_timestamp(now()) - as_timestamp(as_datetime('2025-06-01'))) / 3600) %}
{% set vat = 21 %}
{{ ((hours + 1) * (states("input_number.electricity_fix_month") |float * 12 / 365 / 24) * (1 + vat / 100)) | round(2) }}
unit_of_measurement: "CZK"
state_class: total_increasing