fix battery percent by using value_json as input
This commit is contained in:
parent
81b36f271e
commit
fa4c085b32
@ -26,7 +26,7 @@ namespace OilTank {
|
||||
.asDevice(device)
|
||||
.withValueTemplate("{{ value_json.sensor.temperature }}")
|
||||
.addDiagnostic(new VoltageSensor{id, "Battery voltage", "{{ value_json.sensor.diagnostic.voltage }}"})
|
||||
.addDiagnostic(new BatterySensor{id, "Battery level", "{{ ((states('sensor.servers_room_battery_voltage')|float-2.5)|round(2)*100/2)|int }}"})
|
||||
.addDiagnostic(new BatterySensor{id, "Battery level", "{{ ((value_json.sensor.diagnostic.voltage|float-2.5)|round(2)*100/2)|int }}"})
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ namespace OilTank {
|
||||
.build()
|
||||
)
|
||||
.addDiagnostic(new VoltageSensor{id, "Battery voltage", "{{ value_json.sensor.diagnostic.voltage }}"})
|
||||
.addDiagnostic(new BatterySensor{id, "Battery level", "{{ ((states('sensor.oil_tank_battery_voltage')|float-4.8)|round(2)*100/1.6)|int }}"})
|
||||
.addDiagnostic(new BatterySensor{id, "Battery level", "{{ ((value_json.sensor.diagnostic.voltage|float-4.8)|round(2)*100/1.6)|int }}"})
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user