Skip to content

Commit

Permalink
Fix missing translations for power meter current sensors
Browse files Browse the repository at this point in the history
Fixes #890
  • Loading branch information
wlcrs committed Jan 24, 2025
1 parent e585543 commit 49f7709
Show file tree
Hide file tree
Showing 14 changed files with 292 additions and 97 deletions.
10 changes: 5 additions & 5 deletions sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1557,13 +1557,13 @@ def _days_effective_to_str(days: tuple[bool, bool, bool, bool, bool, bool, bool]
value = ""
for i in range(7): # Sunday is on index 0, but we want to name it day 7
if days[(i + 1) % 7]:
value += f"{i+1}"
value += f"{i + 1}"

return value


def _time_int_to_str(time):
return f"{time//60:02d}:{time%60:02d}"
return f"{time // 60:02d}:{time % 60:02d}"


class HuaweiSolarTOUPricePeriodsSensorEntity(
Expand Down Expand Up @@ -1633,14 +1633,14 @@ def _handle_coordinator_update(self) -> None:
self._attr_extra_state_attributes.clear()
elif isinstance(data[0], LG_RESU_TimeOfUsePeriod):
self._attr_extra_state_attributes = {
f"Period {idx+1}": self._lg_resu_period_to_text(
f"Period {idx + 1}": self._lg_resu_period_to_text(
cast(LG_RESU_TimeOfUsePeriod, period)
)
for idx, period in enumerate(data)
}
elif isinstance(data[0], HUAWEI_LUNA2000_TimeOfUsePeriod):
self._attr_extra_state_attributes = {
f"Period {idx+1}": self._huawei_luna2000_period_to_text(period)
f"Period {idx + 1}": self._huawei_luna2000_period_to_text(period)
for idx, period in enumerate(data)
}
else:
Expand Down Expand Up @@ -1704,7 +1704,7 @@ def _handle_coordinator_update(self) -> None:
self._attr_available = True
self._attr_native_value = len(data)
self._attr_extra_state_attributes = {
f"Period {idx+1}": self._period_to_text(period)
f"Period {idx + 1}": self._period_to_text(period)
for idx, period in enumerate(data)
}
else:
Expand Down
34 changes: 19 additions & 15 deletions strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@
"phase_c_current": {
"name": "Phase C current"
},
"active_grid_a_current": {
"name": "Phase A current"
},
"active_grid_b_current": {
"name": "Phase B current"
},
"active_grid_c_current": {
"name": "Phase C current"
},
"day_active_power_peak": {
"name": "Day active power peak"
},
Expand Down Expand Up @@ -486,21 +495,21 @@
"active_power_control": {
"name": "Active power control"
},
"soh_calibration_status":{
"soh_calibration_status": {
"name": "SOH calibration status"
},
"pack_1_max_temperature": {
"name": "Pack 1 max temperature"
},
"pack_1_min_temperature": {
"name": "Pack 1 min temperature"
},
},
"pack_2_max_temperature": {
"name": "Pack 2 max temperature"
},
"pack_2_min_temperature": {
"name": "Pack 2 min temperature"
},
},
"pack_3_max_temperature": {
"name": "Pack 3 max temperature"
},
Expand All @@ -509,17 +518,16 @@
},
"pack_1_working_status": {
"name": "Pack 1 working status"
},
},
"pack_2_working_status": {
"name": "Pack 2 working status"
},
},
"pack_3_working_status": {
"name": "Pack 3 working status"
},

},
"pack_1_firmware_version": {
"name": "Pack 1 firmware version"
},
},
"pack_1_serial_number": {
"name": "Pack 1 serial number"
},
Expand All @@ -544,10 +552,9 @@
"pack_1_total_discharge": {
"name": "Pack 1 total discharge"
},

"pack_2_firmware_version": {
"name": "Pack 2 firmware version"
},
},
"pack_2_serial_number": {
"name": "Pack 2 serial number"
},
Expand All @@ -572,10 +579,9 @@
"pack_2_total_discharge": {
"name": "Pack 2 total discharge"
},

"pack_3_firmware_version": {
"name": "Pack 3 firmware version"
},
},
"pack_3_serial_number": {
"name": "Pack 3 serial number"
},
Expand All @@ -600,8 +606,6 @@
"pack_3_total_discharge": {
"name": "Pack 3 total discharge"
},


"bms_temperature": {
"name": "BMS temperature"
},
Expand Down Expand Up @@ -964,4 +968,4 @@
"name": "Battery 2"
}
}
}
}
65 changes: 40 additions & 25 deletions translations/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
},
"emma_maximum_feed_grid_power_watt": {
"name": "Maximum feed grid power"
<<<<<<< HEAD
=======
},
"mppt_scanning_interval": {
"name": "MPPT scan interval"
>>>>>>> 18f7306 (Fix missing translations for power meter current sensors)
}
},
"sensor": {
Expand Down Expand Up @@ -489,36 +495,12 @@
"soh_calibration_status": {
"name": "SOH calibration status"
},
"pack_1_max_temperature": {
"name": "Pack 1 max temperature"
},
"pack_1_min_temperature": {
"name": "Pack 1 min temperature"
},
"pack_2_max_temperature": {
"name": "Pack 2 max temperature"
},
"pack_2_min_temperature": {
"name": "Pack 2 min temperature"
},
"pack_3_max_temperature": {
"name": "Pack 3 max temperature"
},
"pack_3_min_temperature": {
"name": "Pack 3 min temperature"
},
"pack_1_working_status": {
"name": "Pack 1 working status"
},
"pack_2_working_status": {
"name": "Pack 2 working status"
},
"pack_3_working_status": {
"name": "Pack 3 working status"
},
"pack_1_firmware_version": {
"name": "Pack 1 firmware version"
},
"pack_1_serial_number": {
"name": "Pack 1 serial number"
},
Expand Down Expand Up @@ -695,6 +677,39 @@
},
"backup_power_state_of_charge": {
"name": "Backup power state of charge"
},
"pack_1_max_temperature": {
"name": "Pack 1 max temperature"
},
"pack_1_min_temperature": {
"name": "Pack 1 min temperature"
},
"pack_2_max_temperature": {
"name": "Pack 2 max temperature"
},
"pack_2_min_temperature": {
"name": "Pack 2 min temperature"
},
"pack_3_max_temperature": {
"name": "Pack 3 max temperature"
},
"pack_3_min_temperature": {
"name": "Pack 3 min temperature"
},
"pack_1_working_status": {
"name": "Pack 1 working status"
},
"pack_1_firmware_version": {
"name": "Pack 1 firmware version"
},
"active_grid_a_current": {
"name": "Corrent de fase A"
},
"active_grid_b_current": {
"name": "Corrent de fase B"
},
"active_grid_c_current": {
"name": "Corrent de fase C"
}
},
"select": {
Expand Down Expand Up @@ -959,4 +974,4 @@
"name": "Battery 2"
}
}
}
}
36 changes: 21 additions & 15 deletions translations/ca_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
},
"storage_power_of_charge_from_grid": {
"name": "Potència màxima de càrrega des de la xarxa"
},
"mppt_scanning_interval":{
},
"mppt_scanning_interval": {
"name": "MPPT scan interval"
}
},
Expand Down Expand Up @@ -530,21 +530,21 @@
"total_energy_consumption": {
"name": "Total energy consumption"
},
"soh_calibration_status":{
"soh_calibration_status": {
"name": "SOH calibration status"
},
"pack_1_max_temperature": {
"name": "Pack 1 max temperature"
},
"pack_1_min_temperature": {
"name": "Pack 1 min temperature"
},
},
"pack_2_max_temperature": {
"name": "Pack 2 max temperature"
},
"pack_2_min_temperature": {
"name": "Pack 2 min temperature"
},
},
"pack_3_max_temperature": {
"name": "Pack 3 max temperature"
},
Expand All @@ -553,14 +553,14 @@
},
"pack_1_working_status": {
"name": "Pack 1 working status"
},
},
"pack_2_working_status": {
"name": "Pack 2 working status"
},
},
"pack_3_working_status": {
"name": "Pack 3 working status"
},
"pack_1_firmware_version": {
},
"pack_1_firmware_version": {
"name": "Pack 1 firmware version"
},
"pack_1_serial_number": {
Expand All @@ -587,10 +587,9 @@
"pack_1_total_discharge": {
"name": "Pack 1 total discharge"
},

"pack_2_firmware_version": {
"name": "Pack 2 firmware version"
},
},
"pack_2_serial_number": {
"name": "Pack 2 serial number"
},
Expand All @@ -615,10 +614,9 @@
"pack_2_total_discharge": {
"name": "Pack 2 total discharge"
},

"pack_3_firmware_version": {
"name": "Pack 3 firmware version"
},
},
"pack_3_serial_number": {
"name": "Pack 3 serial number"
},
Expand All @@ -643,9 +641,17 @@
"pack_3_total_discharge": {
"name": "Pack 3 total discharge"
},

"bms_temperature": {
"name": "BMS temperature"
},
"active_grid_a_current": {
"name": "Corrent de fase A"
},
"active_grid_b_current": {
"name": "Corrent de fase B"
},
"active_grid_c_current": {
"name": "Corrent de fase C"
}
},
"switch": {
Expand Down Expand Up @@ -844,4 +850,4 @@
"name": "Aturar la càrrega o descàrrega forçada"
}
}
}
}
11 changes: 10 additions & 1 deletion translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,15 @@
"grid_c_current": {
"name": "Phase C Strom"
},
"active_grid_a_current": {
"name": "Phase A Strom"
},
"active_grid_b_current": {
"name": "Phase B Strom"
},
"active_grid_c_current": {
"name": "Phase C Strom"
},
"active_grid_a_b_voltage": {
"name": "A-B-Netzspannung"
},
Expand Down Expand Up @@ -959,4 +968,4 @@
"name": "Batterie 2"
}
}
}
}
Loading

0 comments on commit 49f7709

Please sign in to comment.