# 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
template:
- sensor:
name: "Main Geyser Energy Needed"
unit_of_measurement: "kWh"
state_class: "measurement"
force_update: true
state: >
{% set cold_temp = states('sensor.main_geyser_temp_current') | float(default=0) %}
{% set delta_t = (65 - cold_temp) | abs %} # Calculate temp difference
# Formula: 1.16 Wh/L/°C * Volume * Delta T / 1000 (to get kWh)
{% set energy_wh = 1.16 * 150 * delta_t %}
{{ (energy_wh / 1000) | round(2) }}
Same code in template give a value as seen in pictures
So i would appreciate it someone can fix my code. I hand a similar template but unfortunately my rpi4 broke so i cant code anymore. Currently i am running a containter(docker) home assistant in a mini pc.
Due to me being new im only allowed to post one image per post. here is the sample code in the template tester to show that the code actually gives a value