Add more states to error sensor in Husqvarna Automower (#143270)

* Add more states to error sensor in Husqvarna Automower

* Use new common state

* tests and duplicates
This commit is contained in:
Thomas55555 2025-04-19 21:16:01 +02:00 committed by GitHub
parent 9de136789c
commit 012f6b660c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 56 additions and 131 deletions

View File

@ -40,8 +40,7 @@ PARALLEL_UPDATES = 0
ATTR_WORK_AREA_ID_ASSIGNMENT = "work_area_id_assignment"
ERROR_KEY_LIST = [
"no_error",
ERROR_KEYS = [
"alarm_mower_in_motion",
"alarm_mower_lifted",
"alarm_mower_stopped",
@ -50,13 +49,11 @@ ERROR_KEY_LIST = [
"alarm_outside_geofence",
"angular_sensor_problem",
"battery_problem",
"battery_problem",
"battery_restriction_due_to_ambient_temperature",
"can_error",
"charging_current_too_high",
"charging_station_blocked",
"charging_system_problem",
"charging_system_problem",
"collision_sensor_defect",
"collision_sensor_error",
"collision_sensor_problem_front",
@ -67,24 +64,18 @@ ERROR_KEY_LIST = [
"connection_changed",
"connection_not_changed",
"connectivity_problem",
"connectivity_problem",
"connectivity_problem",
"connectivity_problem",
"connectivity_problem",
"connectivity_problem",
"connectivity_settings_restored",
"cutting_drive_motor_1_defect",
"cutting_drive_motor_2_defect",
"cutting_drive_motor_3_defect",
"cutting_height_blocked",
"cutting_height_problem",
"cutting_height_problem_curr",
"cutting_height_problem_dir",
"cutting_height_problem_drive",
"cutting_height_problem",
"cutting_motor_problem",
"cutting_stopped_slope_too_steep",
"cutting_system_blocked",
"cutting_system_blocked",
"cutting_system_imbalance_warning",
"cutting_system_major_imbalance",
"destination_not_reachable",
@ -92,13 +83,9 @@ ERROR_KEY_LIST = [
"docking_sensor_defect",
"electronic_problem",
"empty_battery",
MowerStates.ERROR.lower(),
MowerStates.ERROR_AT_POWER_UP.lower(),
MowerStates.FATAL_ERROR.lower(),
"folding_cutting_deck_sensor_defect",
"folding_sensor_activated",
"geofence_problem",
"geofence_problem",
"gps_navigation_problem",
"guide_1_not_found",
"guide_2_not_found",
@ -116,7 +103,6 @@ ERROR_KEY_LIST = [
"lift_sensor_defect",
"lifted",
"limited_cutting_height_range",
"limited_cutting_height_range",
"loop_sensor_defect",
"loop_sensor_problem_front",
"loop_sensor_problem_left",
@ -129,6 +115,7 @@ ERROR_KEY_LIST = [
"no_accurate_position_from_satellites",
"no_confirmed_position",
"no_drive",
"no_error",
"no_loop_signal",
"no_power_in_charging_station",
"no_response_from_charger",
@ -139,9 +126,6 @@ ERROR_KEY_LIST = [
"safety_function_faulty",
"settings_restored",
"sim_card_locked",
"sim_card_locked",
"sim_card_locked",
"sim_card_locked",
"sim_card_not_found",
"sim_card_requires_pin",
"slipped_mower_has_slipped_situation_not_solved_with_moving_pattern",
@ -151,13 +135,6 @@ ERROR_KEY_LIST = [
"stuck_in_charging_station",
"switch_cord_problem",
"temporary_battery_problem",
"temporary_battery_problem",
"temporary_battery_problem",
"temporary_battery_problem",
"temporary_battery_problem",
"temporary_battery_problem",
"temporary_battery_problem",
"temporary_battery_problem",
"tilt_sensor_problem",
"too_high_discharge_current",
"too_high_internal_current",
@ -189,11 +166,19 @@ ERROR_KEY_LIST = [
"zone_generator_problem",
]
ERROR_STATES = {
MowerStates.ERROR,
ERROR_STATES = [
MowerStates.ERROR_AT_POWER_UP,
MowerStates.ERROR,
MowerStates.FATAL_ERROR,
}
MowerStates.OFF,
MowerStates.STOPPED,
MowerStates.WAIT_POWER_UP,
MowerStates.WAIT_UPDATING,
]
ERROR_KEY_LIST = list(
dict.fromkeys(ERROR_KEYS + [state.lower() for state in ERROR_STATES])
)
RESTRICTED_REASONS: list = [
RestrictedReasons.ALL_WORK_AREAS_COMPLETED,

View File

@ -106,10 +106,10 @@
"cutting_drive_motor_2_defect": "Cutting drive motor 2 defect",
"cutting_drive_motor_3_defect": "Cutting drive motor 3 defect",
"cutting_height_blocked": "Cutting height blocked",
"cutting_height_problem": "Cutting height problem",
"cutting_height_problem_curr": "Cutting height problem, curr",
"cutting_height_problem_dir": "Cutting height problem, dir",
"cutting_height_problem_drive": "Cutting height problem, drive",
"cutting_height_problem": "Cutting height problem",
"cutting_motor_problem": "Cutting motor problem",
"cutting_stopped_slope_too_steep": "Cutting stopped - slope too steep",
"cutting_system_blocked": "Cutting system blocked",
@ -120,8 +120,8 @@
"docking_sensor_defect": "Docking sensor defect",
"electronic_problem": "Electronic problem",
"empty_battery": "Empty battery",
"error": "Error",
"error_at_power_up": "Error at power up",
"error": "[%key:common::state::error%]",
"fatal_error": "Fatal error",
"folding_cutting_deck_sensor_defect": "Folding cutting deck sensor defect",
"folding_sensor_activated": "Folding sensor activated",
@ -159,6 +159,7 @@
"no_loop_signal": "No loop signal",
"no_power_in_charging_station": "No power in charging station",
"no_response_from_charger": "No response from charger",
"off": "[%key:common::state::off%]",
"outside_working_area": "Outside working area",
"poor_signal_quality": "Poor signal quality",
"reference_station_communication_problem": "Reference station communication problem",
@ -172,6 +173,7 @@
"slope_too_steep": "Slope too steep",
"sms_could_not_be_sent": "SMS could not be sent",
"stop_button_problem": "STOP button problem",
"stopped": "[%key:common::state::stopped%]",
"stuck_in_charging_station": "Stuck in charging station",
"switch_cord_problem": "Switch cord problem",
"temporary_battery_problem": "Temporary battery problem",
@ -187,6 +189,8 @@
"unexpected_cutting_height_adj": "Unexpected cutting height adjustment",
"unexpected_error": "Unexpected error",
"upside_down": "Upside down",
"wait_power_up": "Wait power up",
"wait_updating": "Wait updating",
"weak_gps_signal": "Weak GPS signal",
"wheel_drive_problem_left": "Left wheel drive problem",
"wheel_drive_problem_rear_left": "Rear left wheel drive problem",

View File

@ -171,7 +171,6 @@
'area_id': None,
'capabilities': dict({
'options': list([
'no_error',
'alarm_mower_in_motion',
'alarm_mower_lifted',
'alarm_mower_stopped',
@ -180,13 +179,11 @@
'alarm_outside_geofence',
'angular_sensor_problem',
'battery_problem',
'battery_problem',
'battery_restriction_due_to_ambient_temperature',
'can_error',
'charging_current_too_high',
'charging_station_blocked',
'charging_system_problem',
'charging_system_problem',
'collision_sensor_defect',
'collision_sensor_error',
'collision_sensor_problem_front',
@ -197,24 +194,18 @@
'connection_changed',
'connection_not_changed',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_settings_restored',
'cutting_drive_motor_1_defect',
'cutting_drive_motor_2_defect',
'cutting_drive_motor_3_defect',
'cutting_height_blocked',
'cutting_height_problem',
'cutting_height_problem_curr',
'cutting_height_problem_dir',
'cutting_height_problem_drive',
'cutting_height_problem',
'cutting_motor_problem',
'cutting_stopped_slope_too_steep',
'cutting_system_blocked',
'cutting_system_blocked',
'cutting_system_imbalance_warning',
'cutting_system_major_imbalance',
'destination_not_reachable',
@ -222,13 +213,9 @@
'docking_sensor_defect',
'electronic_problem',
'empty_battery',
'error',
'error_at_power_up',
'fatal_error',
'folding_cutting_deck_sensor_defect',
'folding_sensor_activated',
'geofence_problem',
'geofence_problem',
'gps_navigation_problem',
'guide_1_not_found',
'guide_2_not_found',
@ -246,7 +233,6 @@
'lift_sensor_defect',
'lifted',
'limited_cutting_height_range',
'limited_cutting_height_range',
'loop_sensor_defect',
'loop_sensor_problem_front',
'loop_sensor_problem_left',
@ -259,6 +245,7 @@
'no_accurate_position_from_satellites',
'no_confirmed_position',
'no_drive',
'no_error',
'no_loop_signal',
'no_power_in_charging_station',
'no_response_from_charger',
@ -269,9 +256,6 @@
'safety_function_faulty',
'settings_restored',
'sim_card_locked',
'sim_card_locked',
'sim_card_locked',
'sim_card_locked',
'sim_card_not_found',
'sim_card_requires_pin',
'slipped_mower_has_slipped_situation_not_solved_with_moving_pattern',
@ -281,13 +265,6 @@
'stuck_in_charging_station',
'switch_cord_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'tilt_sensor_problem',
'too_high_discharge_current',
'too_high_internal_current',
@ -317,6 +294,13 @@
'wrong_loop_signal',
'wrong_pin_code',
'zone_generator_problem',
'error_at_power_up',
'error',
'fatal_error',
'off',
'stopped',
'wait_power_up',
'wait_updating',
]),
}),
'config_entry_id': <ANY>,
@ -353,7 +337,6 @@
'device_class': 'enum',
'friendly_name': 'Test Mower 1 Error',
'options': list([
'no_error',
'alarm_mower_in_motion',
'alarm_mower_lifted',
'alarm_mower_stopped',
@ -362,13 +345,11 @@
'alarm_outside_geofence',
'angular_sensor_problem',
'battery_problem',
'battery_problem',
'battery_restriction_due_to_ambient_temperature',
'can_error',
'charging_current_too_high',
'charging_station_blocked',
'charging_system_problem',
'charging_system_problem',
'collision_sensor_defect',
'collision_sensor_error',
'collision_sensor_problem_front',
@ -379,24 +360,18 @@
'connection_changed',
'connection_not_changed',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_settings_restored',
'cutting_drive_motor_1_defect',
'cutting_drive_motor_2_defect',
'cutting_drive_motor_3_defect',
'cutting_height_blocked',
'cutting_height_problem',
'cutting_height_problem_curr',
'cutting_height_problem_dir',
'cutting_height_problem_drive',
'cutting_height_problem',
'cutting_motor_problem',
'cutting_stopped_slope_too_steep',
'cutting_system_blocked',
'cutting_system_blocked',
'cutting_system_imbalance_warning',
'cutting_system_major_imbalance',
'destination_not_reachable',
@ -404,13 +379,9 @@
'docking_sensor_defect',
'electronic_problem',
'empty_battery',
'error',
'error_at_power_up',
'fatal_error',
'folding_cutting_deck_sensor_defect',
'folding_sensor_activated',
'geofence_problem',
'geofence_problem',
'gps_navigation_problem',
'guide_1_not_found',
'guide_2_not_found',
@ -428,7 +399,6 @@
'lift_sensor_defect',
'lifted',
'limited_cutting_height_range',
'limited_cutting_height_range',
'loop_sensor_defect',
'loop_sensor_problem_front',
'loop_sensor_problem_left',
@ -441,6 +411,7 @@
'no_accurate_position_from_satellites',
'no_confirmed_position',
'no_drive',
'no_error',
'no_loop_signal',
'no_power_in_charging_station',
'no_response_from_charger',
@ -451,9 +422,6 @@
'safety_function_faulty',
'settings_restored',
'sim_card_locked',
'sim_card_locked',
'sim_card_locked',
'sim_card_locked',
'sim_card_not_found',
'sim_card_requires_pin',
'slipped_mower_has_slipped_situation_not_solved_with_moving_pattern',
@ -463,13 +431,6 @@
'stuck_in_charging_station',
'switch_cord_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'tilt_sensor_problem',
'too_high_discharge_current',
'too_high_internal_current',
@ -499,6 +460,13 @@
'wrong_loop_signal',
'wrong_pin_code',
'zone_generator_problem',
'error_at_power_up',
'error',
'fatal_error',
'off',
'stopped',
'wait_power_up',
'wait_updating',
]),
}),
'context': <ANY>,
@ -1449,7 +1417,6 @@
'area_id': None,
'capabilities': dict({
'options': list([
'no_error',
'alarm_mower_in_motion',
'alarm_mower_lifted',
'alarm_mower_stopped',
@ -1458,13 +1425,11 @@
'alarm_outside_geofence',
'angular_sensor_problem',
'battery_problem',
'battery_problem',
'battery_restriction_due_to_ambient_temperature',
'can_error',
'charging_current_too_high',
'charging_station_blocked',
'charging_system_problem',
'charging_system_problem',
'collision_sensor_defect',
'collision_sensor_error',
'collision_sensor_problem_front',
@ -1475,24 +1440,18 @@
'connection_changed',
'connection_not_changed',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_settings_restored',
'cutting_drive_motor_1_defect',
'cutting_drive_motor_2_defect',
'cutting_drive_motor_3_defect',
'cutting_height_blocked',
'cutting_height_problem',
'cutting_height_problem_curr',
'cutting_height_problem_dir',
'cutting_height_problem_drive',
'cutting_height_problem',
'cutting_motor_problem',
'cutting_stopped_slope_too_steep',
'cutting_system_blocked',
'cutting_system_blocked',
'cutting_system_imbalance_warning',
'cutting_system_major_imbalance',
'destination_not_reachable',
@ -1500,13 +1459,9 @@
'docking_sensor_defect',
'electronic_problem',
'empty_battery',
'error',
'error_at_power_up',
'fatal_error',
'folding_cutting_deck_sensor_defect',
'folding_sensor_activated',
'geofence_problem',
'geofence_problem',
'gps_navigation_problem',
'guide_1_not_found',
'guide_2_not_found',
@ -1524,7 +1479,6 @@
'lift_sensor_defect',
'lifted',
'limited_cutting_height_range',
'limited_cutting_height_range',
'loop_sensor_defect',
'loop_sensor_problem_front',
'loop_sensor_problem_left',
@ -1537,6 +1491,7 @@
'no_accurate_position_from_satellites',
'no_confirmed_position',
'no_drive',
'no_error',
'no_loop_signal',
'no_power_in_charging_station',
'no_response_from_charger',
@ -1547,9 +1502,6 @@
'safety_function_faulty',
'settings_restored',
'sim_card_locked',
'sim_card_locked',
'sim_card_locked',
'sim_card_locked',
'sim_card_not_found',
'sim_card_requires_pin',
'slipped_mower_has_slipped_situation_not_solved_with_moving_pattern',
@ -1559,13 +1511,6 @@
'stuck_in_charging_station',
'switch_cord_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'tilt_sensor_problem',
'too_high_discharge_current',
'too_high_internal_current',
@ -1595,6 +1540,13 @@
'wrong_loop_signal',
'wrong_pin_code',
'zone_generator_problem',
'error_at_power_up',
'error',
'fatal_error',
'off',
'stopped',
'wait_power_up',
'wait_updating',
]),
}),
'config_entry_id': <ANY>,
@ -1631,7 +1583,6 @@
'device_class': 'enum',
'friendly_name': 'Test Mower 2 Error',
'options': list([
'no_error',
'alarm_mower_in_motion',
'alarm_mower_lifted',
'alarm_mower_stopped',
@ -1640,13 +1591,11 @@
'alarm_outside_geofence',
'angular_sensor_problem',
'battery_problem',
'battery_problem',
'battery_restriction_due_to_ambient_temperature',
'can_error',
'charging_current_too_high',
'charging_station_blocked',
'charging_system_problem',
'charging_system_problem',
'collision_sensor_defect',
'collision_sensor_error',
'collision_sensor_problem_front',
@ -1657,24 +1606,18 @@
'connection_changed',
'connection_not_changed',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_problem',
'connectivity_settings_restored',
'cutting_drive_motor_1_defect',
'cutting_drive_motor_2_defect',
'cutting_drive_motor_3_defect',
'cutting_height_blocked',
'cutting_height_problem',
'cutting_height_problem_curr',
'cutting_height_problem_dir',
'cutting_height_problem_drive',
'cutting_height_problem',
'cutting_motor_problem',
'cutting_stopped_slope_too_steep',
'cutting_system_blocked',
'cutting_system_blocked',
'cutting_system_imbalance_warning',
'cutting_system_major_imbalance',
'destination_not_reachable',
@ -1682,13 +1625,9 @@
'docking_sensor_defect',
'electronic_problem',
'empty_battery',
'error',
'error_at_power_up',
'fatal_error',
'folding_cutting_deck_sensor_defect',
'folding_sensor_activated',
'geofence_problem',
'geofence_problem',
'gps_navigation_problem',
'guide_1_not_found',
'guide_2_not_found',
@ -1706,7 +1645,6 @@
'lift_sensor_defect',
'lifted',
'limited_cutting_height_range',
'limited_cutting_height_range',
'loop_sensor_defect',
'loop_sensor_problem_front',
'loop_sensor_problem_left',
@ -1719,6 +1657,7 @@
'no_accurate_position_from_satellites',
'no_confirmed_position',
'no_drive',
'no_error',
'no_loop_signal',
'no_power_in_charging_station',
'no_response_from_charger',
@ -1729,9 +1668,6 @@
'safety_function_faulty',
'settings_restored',
'sim_card_locked',
'sim_card_locked',
'sim_card_locked',
'sim_card_locked',
'sim_card_not_found',
'sim_card_requires_pin',
'slipped_mower_has_slipped_situation_not_solved_with_moving_pattern',
@ -1741,13 +1677,6 @@
'stuck_in_charging_station',
'switch_cord_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'temporary_battery_problem',
'tilt_sensor_problem',
'too_high_discharge_current',
'too_high_internal_current',
@ -1777,6 +1706,13 @@
'wrong_loop_signal',
'wrong_pin_code',
'zone_generator_problem',
'error_at_power_up',
'error',
'fatal_error',
'off',
'stopped',
'wait_power_up',
'wait_updating',
]),
}),
'context': <ANY>,