Add translated enum entity for Fronius error code (#133394)

This commit is contained in:
Matthias Alphart 2024-12-23 09:17:52 +01:00 committed by GitHub
parent ddb3edca5d
commit 9e1ba004d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 1257 additions and 9 deletions

View File

@ -68,6 +68,167 @@ def get_inverter_status_message(code: StateType) -> InverterStatusCodeOption | N
return _INVERTER_STATUS_CODES.get(code) # type: ignore[arg-type]
INVERTER_ERROR_CODES: Final[dict[int, str]] = {
0: "no_error",
102: "ac_voltage_too_high",
103: "ac_voltage_too_low",
105: "ac_frequency_too_high",
106: "ac_frequency_too_low",
107: "ac_grid_outside_permissible_limits",
108: "stand_alone_operation_detected",
112: "rcmu_error",
240: "arc_detection_triggered",
241: "arc_detection_triggered",
242: "arc_detection_triggered",
243: "arc_detection_triggered",
301: "overcurrent_ac",
302: "overcurrent_dc",
303: "dc_module_over_temperature",
304: "ac_module_over_temperature",
305: "no_power_fed_in_despite_closed_relay",
306: "pv_output_too_low_for_feeding_energy_into_the_grid",
307: "low_pv_voltage_dc_input_voltage_too_low",
308: "intermediate_circuit_voltage_too_high",
309: "dc_input_voltage_mppt_1_too_high",
311: "polarity_of_dc_strings_reversed",
313: "dc_input_voltage_mppt_2_too_high",
314: "current_sensor_calibration_timeout",
315: "ac_current_sensor_error",
316: "interrupt_check_fail",
325: "overtemperature_in_connection_area",
326: "fan_1_error",
327: "fan_2_error",
401: "no_communication_with_power_stage_set",
406: "ac_module_temperature_sensor_faulty_l1",
407: "ac_module_temperature_sensor_faulty_l2",
408: "dc_component_measured_in_grid_too_high",
412: "fixed_voltage_mode_out_of_range",
415: "safety_cut_out_triggered",
416: "no_communication_between_power_stage_and_control_system",
417: "hardware_id_problem",
419: "unique_id_conflict",
420: "no_communication_with_hybrid_manager",
421: "hid_range_error",
425: "no_communication_with_power_stage_set",
426: "possible_hardware_fault",
427: "possible_hardware_fault",
428: "possible_hardware_fault",
431: "software_problem",
436: "functional_incompatibility_between_pc_boards",
437: "power_stage_set_problem",
438: "functional_incompatibility_between_pc_boards",
443: "intermediate_circuit_voltage_too_low_or_asymmetric",
445: "compatibility_error_invalid_power_stage_configuration",
447: "insulation_fault",
448: "neutral_conductor_not_connected",
450: "guard_cannot_be_found",
451: "memory_error_detected",
452: "communication",
502: "insulation_error_on_solar_panels",
509: "no_energy_fed_into_grid_past_24_hours",
515: "no_communication_with_filter",
516: "no_communication_with_storage_unit",
517: "power_derating_due_to_high_temperature",
518: "internal_dsp_malfunction",
519: "no_communication_with_storage_unit",
520: "no_energy_fed_by_mppt1_past_24_hours",
522: "dc_low_string_1",
523: "dc_low_string_2",
558: "functional_incompatibility_between_pc_boards",
559: "functional_incompatibility_between_pc_boards",
560: "derating_caused_by_over_frequency",
564: "functional_incompatibility_between_pc_boards",
566: "arc_detector_switched_off",
567: "grid_voltage_dependent_power_reduction_active",
601: "can_bus_full",
603: "ac_module_temperature_sensor_faulty_l3",
604: "dc_module_temperature_sensor_faulty",
607: "rcmu_error",
608: "functional_incompatibility_between_pc_boards",
701: "internal_processor_status",
702: "internal_processor_status",
703: "internal_processor_status",
704: "internal_processor_status",
705: "internal_processor_status",
706: "internal_processor_status",
707: "internal_processor_status",
708: "internal_processor_status",
709: "internal_processor_status",
710: "internal_processor_status",
711: "internal_processor_status",
712: "internal_processor_status",
713: "internal_processor_status",
714: "internal_processor_status",
715: "internal_processor_status",
716: "internal_processor_status",
721: "eeprom_reinitialised",
722: "internal_processor_status",
723: "internal_processor_status",
724: "internal_processor_status",
725: "internal_processor_status",
726: "internal_processor_status",
727: "internal_processor_status",
728: "internal_processor_status",
729: "internal_processor_status",
730: "internal_processor_status",
731: "initialisation_error_usb_flash_drive_not_supported",
732: "initialisation_error_usb_stick_over_current",
733: "no_usb_flash_drive_connected",
734: "update_file_not_recognised_or_missing",
735: "update_file_does_not_match_device",
736: "write_or_read_error_occurred",
737: "file_could_not_be_opened",
738: "log_file_cannot_be_saved",
740: "initialisation_error_file_system_error_on_usb",
741: "error_during_logging_data_recording",
743: "error_during_update_process",
745: "update_file_corrupt",
746: "error_during_update_process",
751: "time_lost",
752: "real_time_clock_communication_error",
753: "real_time_clock_in_emergency_mode",
754: "internal_processor_status",
755: "internal_processor_status",
757: "real_time_clock_hardware_error",
758: "real_time_clock_in_emergency_mode",
760: "internal_hardware_error",
761: "internal_processor_status",
762: "internal_processor_status",
763: "internal_processor_status",
764: "internal_processor_status",
765: "internal_processor_status",
766: "emergency_power_derating_activated",
767: "internal_processor_status",
768: "different_power_limitation_in_hardware_modules",
772: "storage_unit_not_available",
773: "software_update_invalid_country_setup",
775: "pmc_power_stage_set_not_available",
776: "invalid_device_type",
781: "internal_processor_status",
782: "internal_processor_status",
783: "internal_processor_status",
784: "internal_processor_status",
785: "internal_processor_status",
786: "internal_processor_status",
787: "internal_processor_status",
788: "internal_processor_status",
789: "internal_processor_status",
790: "internal_processor_status",
791: "internal_processor_status",
792: "internal_processor_status",
793: "internal_processor_status",
794: "internal_processor_status",
1001: "insulation_measurement_triggered",
1024: "inverter_settings_changed_restart_required",
1030: "wired_shut_down_triggered",
1036: "grid_frequency_exceeded_limit_reconnecting",
1112: "mains_voltage_dependent_power_reduction",
1175: "too_little_dc_power_for_feed_in_operation",
1196: "inverter_required_setup_values_not_received",
65000: "dc_connection_inverter_battery_interrupted",
}
class MeterLocationCodeOption(StrEnum):
"""Meter location codes for Fronius meters."""

View File

@ -33,6 +33,7 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import (
DOMAIN,
INVERTER_ERROR_CODES,
SOLAR_NET_DISCOVERY_NEW,
InverterStatusCodeOption,
MeterLocationCodeOption,
@ -205,6 +206,15 @@ INVERTER_ENTITY_DESCRIPTIONS: list[FroniusSensorEntityDescription] = [
FroniusSensorEntityDescription(
key="error_code",
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
FroniusSensorEntityDescription(
key="error_message",
response_key="error_code",
entity_category=EntityCategory.DIAGNOSTIC,
device_class=SensorDeviceClass.ENUM,
options=list(dict.fromkeys(INVERTER_ERROR_CODES.values())),
value_fn=INVERTER_ERROR_CODES.get, # type: ignore[arg-type]
),
FroniusSensorEntityDescription(
key="status_code",

View File

@ -73,6 +73,107 @@
"error_code": {
"name": "Error code"
},
"error_message": {
"name": "Error message",
"state": {
"no_error": "No error",
"ac_voltage_too_high": "AC voltage too high",
"ac_voltage_too_low": "AC voltage too low",
"ac_frequency_too_high": "AC frequency too high",
"ac_frequency_too_low": "AC frequency too low",
"ac_grid_outside_permissible_limits": "AC grid outside the permissible limits",
"stand_alone_operation_detected": "Stand alone operation detected",
"rcmu_error": "RCMU error",
"arc_detection_triggered": "Arc detection triggered",
"overcurrent_ac": "Overcurrent (AC)",
"overcurrent_dc": "Overcurrent (DC)",
"dc_module_over_temperature": "DC module over temperature",
"ac_module_over_temperature": "AC module over temperature",
"no_power_fed_in_despite_closed_relay": "No power being fed in, despite closed relay",
"pv_output_too_low_for_feeding_energy_into_the_grid": "PV output too low for feeding energy into the grid",
"low_pv_voltage_dc_input_voltage_too_low": "Low PV voltage - DC input voltage too low for feeding energy into the grid",
"intermediate_circuit_voltage_too_high": "Intermediate circuit voltage too high",
"dc_input_voltage_mppt_1_too_high": "DC input voltage MPPT 1 too high",
"polarity_of_dc_strings_reversed": "Polarity of DC strings reversed",
"dc_input_voltage_mppt_2_too_high": "DC input voltage MPPT 2 too high",
"current_sensor_calibration_timeout": "Current sensor calibration timeout",
"ac_current_sensor_error": "AC current sensor error",
"interrupt_check_fail": "Interrupt Check fail",
"overtemperature_in_connection_area": "Overtemperature in the connection area",
"fan_1_error": "Fan 1 error",
"fan_2_error": "Fan 2 error",
"no_communication_with_power_stage_set": "No communication with the power stage set possible",
"ac_module_temperature_sensor_faulty_l1": "AC module temperature sensor faulty (L1)",
"ac_module_temperature_sensor_faulty_l2": "AC module temperature sensor faulty (L2)",
"dc_component_measured_in_grid_too_high": "DC component measured in the grid too high",
"fixed_voltage_mode_out_of_range": "Fixed voltage mode has been selected instead of MPP voltage mode and the fixed voltage has been set to too low or too high a value",
"safety_cut_out_triggered": "Safety cut out via option card or RECERBO has triggered",
"no_communication_between_power_stage_and_control_system": "No communication possible between power stage set and control system",
"hardware_id_problem": "Hardware ID problem",
"unique_id_conflict": "Unique ID conflict",
"no_communication_with_hybrid_manager": "No communication possible with the Hybrid manager",
"hid_range_error": "HID range error",
"possible_hardware_fault": "Possible hardware fault",
"software_problem": "Software problem",
"functional_incompatibility_between_pc_boards": "Functional incompatibility (one or more PC boards in the inverter are not compatible with each other, e.g. after a PC board has been replaced)",
"power_stage_set_problem": "Power stage set problem",
"intermediate_circuit_voltage_too_low_or_asymmetric": "Intermediate circuit voltage too low or asymmetric",
"compatibility_error_invalid_power_stage_configuration": "Compatibility error (e.g. due to replacement of a PC board) - invalid power stage set configuration",
"insulation_fault": "Insulation fault",
"neutral_conductor_not_connected": "Neutral conductor not connected",
"guard_cannot_be_found": "Guard cannot be found",
"memory_error_detected": "Memory error detected",
"communication": "Communication error",
"insulation_error_on_solar_panels": "Insulation error on the solar panels",
"no_energy_fed_into_grid_past_24_hours": "No energy fed into the grid in the past 24 hours",
"no_communication_with_filter": "No communication with filter possible",
"no_communication_with_storage_unit": "No communication possible with the storage unit",
"power_derating_due_to_high_temperature": "Power derating caused by too high a temperature",
"internal_dsp_malfunction": "Internal DSP malfunction",
"no_energy_fed_by_mppt1_past_24_hours": "No energy fed into the grid by MPPT1 in the past 24 hours",
"dc_low_string_1": "DC low string 1",
"dc_low_string_2": "DC low string 2",
"derating_caused_by_over_frequency": "Derating caused by over-frequency",
"arc_detector_switched_off": "Arc detector switched off (e.g. during external arc monitoring)",
"grid_voltage_dependent_power_reduction_active": "Grid Voltage Dependent Power Reduction is active",
"can_bus_full": "CAN bus is full",
"ac_module_temperature_sensor_faulty_l3": "AC module temperature sensor faulty (L3)",
"dc_module_temperature_sensor_faulty": "DC module temperature sensor faulty",
"internal_processor_status": "Warning about the internal processor status. See status code for more information",
"eeprom_reinitialised": "EEPROM has been re-initialised",
"initialisation_error_usb_flash_drive_not_supported": "Initialisation error USB flash drive is not supported",
"initialisation_error_usb_stick_over_current": "Initialisation error Over current on USB stick",
"no_usb_flash_drive_connected": "No USB flash drive connected",
"update_file_not_recognised_or_missing": "Update file not recognised or not present",
"update_file_does_not_match_device": "Update file does not match the device, update file too old",
"write_or_read_error_occurred": "Write or read error occurred",
"file_could_not_be_opened": "File could not be opened",
"log_file_cannot_be_saved": "Log file cannot be saved (e.g. USB flash drive is write protected or full)",
"initialisation_error_file_system_error_on_usb": "Initialisation error in file system on USB flash drive",
"error_during_logging_data_recording": "Error during recording of logging data",
"error_during_update_process": "Error occurred during update process",
"update_file_corrupt": "Update file corrupt",
"time_lost": "Time lost",
"real_time_clock_communication_error": "Real Time Clock module communication error",
"real_time_clock_in_emergency_mode": "Internal error: Real Time Clock module is in emergency mode",
"real_time_clock_hardware_error": "Hardware error in the Real Time Clock module",
"internal_hardware_error": "Internal hardware error",
"emergency_power_derating_activated": "Emergency power derating activated",
"different_power_limitation_in_hardware_modules": "Different power limitation in the hardware modules",
"storage_unit_not_available": "Storage unit not available",
"software_update_invalid_country_setup": "Software update group 0 (invalid country setup)",
"pmc_power_stage_set_not_available": "PMC power stage set not available",
"invalid_device_type": "Invalid device type",
"insulation_measurement_triggered": "Insulation measurement triggered",
"inverter_settings_changed_restart_required": "Inverter settings have been changed, inverter restart required",
"wired_shut_down_triggered": "Wired shut down triggered",
"grid_frequency_exceeded_limit_reconnecting": "The grid frequency has exceeded a limit value when reconnecting",
"mains_voltage_dependent_power_reduction": "Mains voltage-dependent power reduction",
"too_little_dc_power_for_feed_in_operation": "Too little DC power for feed-in operation",
"inverter_required_setup_values_not_received": "Inverter required setup values could not be received",
"dc_connection_inverter_battery_interrupted": "DC connection between inverter and battery interrupted"
}
},
"status_code": {
"name": "Status code"
},

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@ async def test_symo_inverter(
mock_responses(aioclient_mock, night=True)
await setup_fronius_integration(hass)
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 58
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 59
assert_state("sensor.symo_20_dc_current", 0)
assert_state("sensor.symo_20_energy_day", 10828)
assert_state("sensor.symo_20_total_energy", 44186900)
@ -49,7 +49,7 @@ async def test_symo_inverter(
freezer.tick(FroniusInverterUpdateCoordinator.default_interval)
async_fire_time_changed(hass)
await hass.async_block_till_done()
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 64
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 65
# 4 additional AC entities
assert_state("sensor.symo_20_dc_current", 2.19)
assert_state("sensor.symo_20_energy_day", 1113)
@ -108,7 +108,7 @@ async def test_symo_meter(
mock_responses(aioclient_mock)
await setup_fronius_integration(hass)
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 64
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 65
# states are rounded to 4 decimals
assert_state("sensor.smart_meter_63a_current_phase_1", 7.755)
assert_state("sensor.smart_meter_63a_current_phase_2", 6.68)
@ -205,7 +205,7 @@ async def test_symo_power_flow(
mock_responses(aioclient_mock, night=True)
await setup_fronius_integration(hass)
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 58
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 59
# states are rounded to 4 decimals
assert_state("sensor.solarnet_energy_day", 10828)
assert_state("sensor.solarnet_total_energy", 44186900)
@ -223,7 +223,7 @@ async def test_symo_power_flow(
async_fire_time_changed(hass)
await hass.async_block_till_done()
# 54 because power_flow `rel_SelfConsumption` and `P_PV` is not `null` anymore
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 60
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 61
assert_state("sensor.solarnet_energy_day", 1101.7001)
assert_state("sensor.solarnet_total_energy", 44188000)
assert_state("sensor.solarnet_energy_year", 25508788)
@ -242,7 +242,7 @@ async def test_symo_power_flow(
freezer.tick(FroniusPowerFlowUpdateCoordinator.default_interval)
async_fire_time_changed(hass)
await hass.async_block_till_done()
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 60
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 61
assert_state("sensor.solarnet_energy_day", 10828)
assert_state("sensor.solarnet_total_energy", 44186900)
assert_state("sensor.solarnet_energy_year", 25507686)
@ -271,7 +271,7 @@ async def test_gen24(
mock_responses(aioclient_mock, fixture_set="gen24")
config_entry = await setup_fronius_integration(hass, is_logger=False)
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 58
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 59
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
assert_state("sensor.inverter_name_total_energy", 1530193.42)
@ -313,7 +313,7 @@ async def test_gen24_storage(
hass, is_logger=False, unique_id="12345678"
)
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 72
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 73
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
# Devices
@ -367,7 +367,7 @@ async def test_primo_s0(
mock_responses(aioclient_mock, fixture_set="primo_s0", inverter_ids=[1, 2])
config_entry = await setup_fronius_integration(hass, is_logger=True)
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 47
assert len(hass.states.async_all(domain_filter=SENSOR_DOMAIN)) == 49
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
# Devices