feat: add battery state of charge calculation in JackeryHome sensor
- Implemented a new calculation for battery state of charge (SOC) by multiplying the meter value by 0.1 to convert it to a percentage.
This commit is contained in:
@@ -481,6 +481,9 @@ class JackeryHomeSensor(SensorEntity):
|
||||
return abs(meter_value) if meter_value < 0 else 0
|
||||
elif self._sensor_id == "battery_discharge":
|
||||
return meter_value if meter_value > 0 else 0
|
||||
elif self._sensor_id == "battery_soc":
|
||||
# Battery SOC 需要乘以 0.1 转换为百分比
|
||||
return meter_value * 0.1
|
||||
else:
|
||||
return meter_value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user