fix: sensor
This commit is contained in:
@@ -62,7 +62,7 @@ template:
|
|||||||
state: >
|
state: >
|
||||||
{% set mount_gap = 290 %} {# mm from sensor down to the "full" water line #}
|
{% 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 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) %}
|
{% set height = max_water_height - (distance - mount_gap) %}
|
||||||
{{ [ [height, 0] | max, max_water_height] | min | round(1) }}
|
{{ [ [height, 0] | max, max_water_height] | min | round(1) }}
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ template:
|
|||||||
state: >
|
state: >
|
||||||
{% set diameter = 1450 %} {# mm #}
|
{% set diameter = 1450 %} {# mm #}
|
||||||
{% set radius = diameter / 2 %}
|
{% 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 %}
|
{% set volume_mm3 = 3.14159265 * (radius ** 2) * height %}
|
||||||
{{ (volume_mm3 / 1000000) | round(1) }} {# convert mm³ to liters #}
|
{{ (volume_mm3 / 1000000) | round(1) }} {# convert mm³ to liters #}
|
||||||
|
|
||||||
@@ -84,5 +84,5 @@ template:
|
|||||||
state_class: measurement
|
state_class: measurement
|
||||||
state: >
|
state: >
|
||||||
{% set sensor_offset = 2090 - 290 %} {# full tank height - sensor_mount #}
|
{% 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) }}
|
{{ (height / sensor_offset * 100) | round(1) }}
|
||||||
|
|||||||
Reference in New Issue
Block a user