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:
不求圣剑
2025-11-18 17:29:10 +08:00
parent d065c0cb56
commit 4b8dd033db

View File

@@ -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