From 94d5bd464e4a39b1229bd101cce98bbebf238e86 Mon Sep 17 00:00:00 2001 From: Ernst Klamer Date: Mon, 26 Feb 2024 20:22:42 +0100 Subject: [PATCH] add 3 tank sensors --- custom_components/ble_monitor/const.py | 39 +++++++++++++++++++++++++ custom_components/ble_monitor/sensor.py | 1 + 2 files changed, 40 insertions(+) diff --git a/custom_components/ble_monitor/const.py b/custom_components/ble_monitor/const.py index abbc603b..8570cb80 100755 --- a/custom_components/ble_monitor/const.py +++ b/custom_components/ble_monitor/const.py @@ -1038,6 +1038,42 @@ class BLEMonitorBinarySensorEntityDescription( suggested_display_precision=1, state_class=SensorStateClass.MEASUREMENT, ), + BLEMonitorSensorEntityDescription( + key="fresh tank", + sensor_class="MeasuringSensor", + update_behavior="Averaging", + name="fresh tank", + unique_id="fresh_tank_", + icon="mdi:storage-tank-outline", + native_unit_of_measurement=PERCENTAGE, + device_class=None, + suggested_display_precision=0, + state_class=SensorStateClass.MEASUREMENT, + ), + BLEMonitorSensorEntityDescription( + key="black tank", + sensor_class="MeasuringSensor", + update_behavior="Averaging", + name="black tank", + unique_id="black_tank_", + icon="mdi:storage-tank-outline", + native_unit_of_measurement=PERCENTAGE, + device_class=None, + suggested_display_precision=0, + state_class=SensorStateClass.MEASUREMENT, + ), + BLEMonitorSensorEntityDescription( + key="grey tank", + sensor_class="MeasuringSensor", + update_behavior="Averaging", + name="grey tank", + unique_id="gray_tank_", + icon="mdi:storage-tank-outline", + native_unit_of_measurement=PERCENTAGE, + device_class=None, + suggested_display_precision=0, + state_class=SensorStateClass.MEASUREMENT, + ), BLEMonitorSensorEntityDescription( key="aqi", sensor_class="MeasuringSensor", @@ -2000,6 +2036,7 @@ class BLEMonitorBinarySensorEntityDescription( "acceleration", "ambient temperature", "battery", + "black tank", "button", "co2", "conductivity", @@ -2012,8 +2049,10 @@ class BLEMonitorBinarySensorEntityDescription( "duration", "energy", "flow", + "fresh tank", "gas", "gravity", + "grey tank", "gyroscope", "humidity", "illuminance", diff --git a/custom_components/ble_monitor/sensor.py b/custom_components/ble_monitor/sensor.py index 8759d8b2..8190e9df 100644 --- a/custom_components/ble_monitor/sensor.py +++ b/custom_components/ble_monitor/sensor.py @@ -337,6 +337,7 @@ class BaseSensor(RestoreSensor, SensorEntity): # | |**flow # | |**gas # | |**water + # | |**fresh/grey/black tank # |--InstantUpdateSensor (Class) # | |**consumable # | |**heart rate