fix: sensor

This commit is contained in:
willem.serruys
2026-08-22 19:41:03 +02:00
parent 279a095b05
commit d2ea0f16aa

View File

@@ -62,7 +62,7 @@ template:
state: >
{% set mount_gap = 290 %} {# mm from sensor down to the "full" water line #}
{% set max_water_height = 2090 %} {# mm, tank depth from full line to bottom #}
{% set distance = states('sensor.cistern_distance') | float(0) %}
{% set distance = states('sensor.regenput_sensor_distance') | float(0) %}
{% set height = max_water_height - (distance - mount_gap) %}
{{ [ [height, 0] | max, max_water_height] | min | round(1) }}
@@ -74,7 +74,7 @@ template:
state: >
{% set diameter = 1450 %} {# mm #}
{% set radius = diameter / 2 %}
{% set height = states('sensor.cistern_water_height') | float(0) %}
{% set height = states('sensor.regenput_sensor_distance') | float(0) %}
{% set volume_mm3 = 3.14159265 * (radius ** 2) * height %}
{{ (volume_mm3 / 1000000) | round(1) }} {# convert mm³ to liters #}
@@ -84,5 +84,5 @@ template:
state_class: measurement
state: >
{% set sensor_offset = 2090 - 290 %} {# full tank height - sensor_mount #}
{% set height = states('sensor.cistern_water_height') | float(0) %}
{% set height = states('sensor.regenput_sensor_distance') | float(0) %}
{{ (height / sensor_offset * 100) | round(1) }}