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 return meter_value if meter_value > 0 else 0
# # 电池功率:同一个 meter_sn同步更新 battery_charge_power / battery_discharge_power # # 电池功率:同一个 meter_sn同步更新 battery_charge_power / battery_discharge_power
elif self._sensor_id == "battery_charge_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": 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": if self._sensor_id == "battery_soc":
# Battery SOC 需要乘以 0.1 转换为百分比 # Battery SOC 需要乘以 0.1 转换为百分比
meter_value = meter_value * 0.1 meter_value = meter_value * 0.1

View File

@@ -3,18 +3,21 @@ entities:
grid: grid:
entity: entity:
consumption: sensor.grid_import consumption: sensor.grid_import
production: sensor.grid_import production: sensor.grid_export
display_state: one_way display_state: two_way
color_circle: true color_circle: true
solar: solar:
entity: sensor.solar_power entity: sensor.solar_power
battery: battery:
entity: entity:
consumption: sensor.battery_charge consumption: sensor.battery_discharge
production: sensor.battery_discharge production: sensor.battery_charge
state_of_charge: sensor.battery_state_of_charge state_of_charge: sensor.battery_state_of_charge
display_state: one_way display_state: two_way
color_circle: true color_circle: true
home: home:
color_icon: true color_icon: true
watt_threshold: 10000
watt_threshold: 10000