update calculation for oil tank

This commit is contained in:
Nicu Hodos 2024-06-16 12:09:20 +02:00
parent 9141c8d54e
commit 5fccc50c1e

View File

@ -45,11 +45,11 @@ namespace OilTank {
.addSecondary( .addSecondary(
Builder<Sensor>::instance(new Sensor{ "Level", id }) Builder<Sensor>::instance(new Sensor{ "Level", id })
.withUnitMseasure("%") .withUnitMseasure("%")
.withValueTemplate("{{ 100 - ((value_json.sensor.value-7)|float*100/110)|round(2) }}") .withValueTemplate("{{ 100 - ((value_json.sensor.value-12)|float*100/120)|round(2) }}")
.build() .build()
) )
.addDiagnostic(new VoltageSensor{id, "Battery voltage", "{{ value_json.sensor.diagnostic.voltage }}"}) .addDiagnostic(new VoltageSensor{id, "Battery voltage", "{{ value_json.sensor.diagnostic.voltage }}"})
.addDiagnostic(new BatterySensor{id, "Battery level", "{{ ((states('sensor.oil_tank_battery_voltage')|float-3.6)|round(2)*100/1.6)|int }}"}) .addDiagnostic(new BatterySensor{id, "Battery level", "{{ ((states('sensor.oil_tank_battery_voltage')|float-4.8)|round(2)*100/1.6)|int }}"})
.build(); .build();
} }
} }