refactor: update energy flow card configuration and sensor logic for improved accuracy

- Modified the energy flow card configuration to reflect correct sensor mappings for grid and battery entities, changing production and consumption references.
- Enhanced the JackeryHome sensor logic to ensure accurate power readings for battery charge and discharge, correcting the handling of meter values.
- Updated display states for better representation of energy flow direction.
This commit is contained in:
不求圣剑
2025-11-25 10:24:04 +08:00
parent a641b64a8f
commit 1d50d5a7b0
2 changed files with 11 additions and 8 deletions

View File

@@ -471,9 +471,9 @@ class JackeryHomeSensor(SensorEntity):
return meter_value if meter_value > 0 else 0
# # 电池功率:同一个 meter_sn同步更新 battery_charge_power / battery_discharge_power
elif self._sensor_id == "battery_charge_power":
return abs(meter_value) if meter_value < 0 else 0
return (meter_value) if meter_value > 0 else 0
elif self._sensor_id == "battery_discharge_power":
return meter_value if meter_value > 0 else 0
return abs(meter_value) if meter_value < 0 else 0
if self._sensor_id == "battery_soc":
# Battery SOC 需要乘以 0.1 转换为百分比
meter_value = meter_value * 0.1