diff --git a/custom_components/localthings/registry/capabilities/airconditioner.py b/custom_components/localthings/registry/capabilities/airconditioner.py index 2604b9a..478720d 100644 --- a/custom_components/localthings/registry/capabilities/airconditioner.py +++ b/custom_components/localthings/registry/capabilities/airconditioner.py @@ -742,6 +742,25 @@ AUTO_CLEAN = Capability( write_fn=lambda p, rep, href=None: ( ['option', 'autoclean', 'vs', '0'], {'x.com.samsung.da.settingStatus': 'On' if p == 'On' else 'Off'})), + # The cycle, as opposed to the switch above -- `settingStatus` says the + # feature is enabled, which it is whether or not the unit is drying right + # now. `status` is the run state, and the resource advertises exactly + # Start/Stop in `supportedStatus`. Observed on a TP1X_DA-AC-CAC-01001: + # 'Start' with progress 98 while a cycle ran, then 'Stop' with progress 0 + # the moment it finished. + BinarySensorDesc(key='auto_clean_running', + field='x.com.samsung.da.status', + icon='mdi:spray-bottle', + entity_category='diagnostic', + value_fn=lambda v: v == 'Start'), + # Percent through that cycle, matching the figure the appliance shows on + # its own display (checked against 55% mid-run). + SensorDesc(key='auto_clean_progress', + field='x.com.samsung.da.progress', + icon='mdi:progress-clock', + unit='%', state_class='measurement', + entity_category='diagnostic', + value_fn=common.int_or_none), ), ) diff --git a/custom_components/localthings/translations/cs.json b/custom_components/localthings/translations/cs.json index 551d484..e26e4f7 100644 --- a/custom_components/localthings/translations/cs.json +++ b/custom_components/localthings/translations/cs.json @@ -1,6 +1,9 @@ { "entity": { "binary_sensor": { + "auto_clean_running": { + "name": "Automatické čištění probíhá" + }, "after_run_active": { "name": "Dosoušení aktivní" }, @@ -615,6 +618,9 @@ } }, "sensor": { + "auto_clean_progress": { + "name": "Průběh automatického čištění" + }, "after_run_progress": { "name": "Průběh dosoušení" }, diff --git a/custom_components/localthings/translations/en.json b/custom_components/localthings/translations/en.json index 9b5fa0e..50c86a9 100644 --- a/custom_components/localthings/translations/en.json +++ b/custom_components/localthings/translations/en.json @@ -1,6 +1,9 @@ { "entity": { "binary_sensor": { + "auto_clean_running": { + "name": "Auto clean running" + }, "after_run_active": { "name": "After run active" }, @@ -615,6 +618,9 @@ } }, "sensor": { + "auto_clean_progress": { + "name": "Auto clean progress" + }, "after_run_progress": { "name": "After run progress" }, diff --git a/custom_components/localthings/translations/nl.json b/custom_components/localthings/translations/nl.json index d9043b2..7d2948a 100644 --- a/custom_components/localthings/translations/nl.json +++ b/custom_components/localthings/translations/nl.json @@ -1,6 +1,9 @@ { "entity": { "binary_sensor": { + "auto_clean_running": { + "name": "Auto clean actief" + }, "after_run_active": { "name": "Nadraaien actief" }, @@ -615,6 +618,9 @@ } }, "sensor": { + "auto_clean_progress": { + "name": "Auto clean voortgang" + }, "after_run_progress": { "name": "Voortgang nadraaien" }, diff --git a/tests/fixtures/golden/airconditioner.json b/tests/fixtures/golden/airconditioner.json index ffb4c56..fcafcf5 100644 --- a/tests/fixtures/golden/airconditioner.json +++ b/tests/fixtures/golden/airconditioner.json @@ -6,6 +6,8 @@ "air_purify", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "clean_level", "climate", diff --git a/tests/fixtures/golden/airconditioner_ara_ww_tp1_22.json b/tests/fixtures/golden/airconditioner_ara_ww_tp1_22.json index 7f3ae98..10810e8 100644 --- a/tests/fixtures/golden/airconditioner_ara_ww_tp1_22.json +++ b/tests/fixtures/golden/airconditioner_ara_ww_tp1_22.json @@ -5,6 +5,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/airconditioner_cac.json b/tests/fixtures/golden/airconditioner_cac.json index 108cd73..c00c271 100644 --- a/tests/fixtures/golden/airconditioner_cac.json +++ b/tests/fixtures/golden/airconditioner_cac.json @@ -8,6 +8,8 @@ "air_purify", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "clean_level", "climate", "current_temperature_c", @@ -29,4 +31,4 @@ "super_fine_dust", "tropical_night_mode" ] -} \ No newline at end of file +} diff --git a/tests/fixtures/golden/airconditioner_caww_tp2.json b/tests/fixtures/golden/airconditioner_caww_tp2.json index dc60454..a8d9f69 100644 --- a/tests/fixtures/golden/airconditioner_caww_tp2.json +++ b/tests/fixtures/golden/airconditioner_caww_tp2.json @@ -5,6 +5,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/airconditioner_fac_bora.json b/tests/fixtures/golden/airconditioner_fac_bora.json index ed94db8..a75fc9e 100644 --- a/tests/fixtures/golden/airconditioner_fac_bora.json +++ b/tests/fixtures/golden/airconditioner_fac_bora.json @@ -6,6 +6,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/airconditioner_fac_bora_205_flat.json b/tests/fixtures/golden/airconditioner_fac_bora_205_flat.json index ed94db8..a75fc9e 100644 --- a/tests/fixtures/golden/airconditioner_fac_bora_205_flat.json +++ b/tests/fixtures/golden/airconditioner_fac_bora_205_flat.json @@ -6,6 +6,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/airconditioner_fac_bora_2in1.json b/tests/fixtures/golden/airconditioner_fac_bora_2in1.json index 395d456..652c234 100644 --- a/tests/fixtures/golden/airconditioner_fac_bora_2in1.json +++ b/tests/fixtures/golden/airconditioner_fac_bora_2in1.json @@ -6,6 +6,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/airconditioner_lnx_rac_heatpump.json b/tests/fixtures/golden/airconditioner_lnx_rac_heatpump.json index 6c55309..9cbc8d2 100644 --- a/tests/fixtures/golden/airconditioner_lnx_rac_heatpump.json +++ b/tests/fixtures/golden/airconditioner_lnx_rac_heatpump.json @@ -7,6 +7,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/airconditioner_tp1x_da_ac_rac_01011.json b/tests/fixtures/golden/airconditioner_tp1x_da_ac_rac_01011.json index 0fb30d7..9146f3a 100644 --- a/tests/fixtures/golden/airconditioner_tp1x_da_ac_rac_01011.json +++ b/tests/fixtures/golden/airconditioner_tp1x_da_ac_rac_01011.json @@ -7,6 +7,8 @@ "air_purify", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "clean_level", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/airconditioner_tp1x_rac.json b/tests/fixtures/golden/airconditioner_tp1x_rac.json index b46a854..445a6f9 100644 --- a/tests/fixtures/golden/airconditioner_tp1x_rac.json +++ b/tests/fixtures/golden/airconditioner_tp1x_rac.json @@ -7,6 +7,8 @@ "air_purify", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_limit_enabled", diff --git a/tests/fixtures/golden/airconditioner_tp1x_rac_01001.json b/tests/fixtures/golden/airconditioner_tp1x_rac_01001.json index 7f3ae98..10810e8 100644 --- a/tests/fixtures/golden/airconditioner_tp1x_rac_01001.json +++ b/tests/fixtures/golden/airconditioner_tp1x_rac_01001.json @@ -5,6 +5,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/airconditioner_tp1x_rac_coolonly.json b/tests/fixtures/golden/airconditioner_tp1x_rac_coolonly.json index a138056..9fd5d96 100644 --- a/tests/fixtures/golden/airconditioner_tp1x_rac_coolonly.json +++ b/tests/fixtures/golden/airconditioner_tp1x_rac_coolonly.json @@ -5,6 +5,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/airconditioner_tp1x_rac_odor_controller.json b/tests/fixtures/golden/airconditioner_tp1x_rac_odor_controller.json index 055f6b3..99e808b 100644 --- a/tests/fixtures/golden/airconditioner_tp1x_rac_odor_controller.json +++ b/tests/fixtures/golden/airconditioner_tp1x_rac_odor_controller.json @@ -1,26 +1,28 @@ -{ - "state_keys": [ - "air_filter_status", - "air_filter_threshold", - "air_filter_usage", - "air_filter_usage_hours", - "air_purify", - "alarm_code", - "auto_clean", - "beep", - "climate", - "current_limit_enabled", - "current_limit_level", - "current_temperature_c", - "display_light", - "firmware_update", - "humidity", - "mute_once", - "odor_controller_active", - "odor_controller_progress", - "selfcheck_error", - "selfcheck_result", - "selfcheck_status", - "tropical_night_mode" - ] -} +{ + "state_keys": [ + "air_filter_status", + "air_filter_threshold", + "air_filter_usage", + "air_filter_usage_hours", + "air_purify", + "alarm_code", + "auto_clean", + "auto_clean_progress", + "auto_clean_running", + "beep", + "climate", + "current_limit_enabled", + "current_limit_level", + "current_temperature_c", + "display_light", + "firmware_update", + "humidity", + "mute_once", + "odor_controller_active", + "odor_controller_progress", + "selfcheck_error", + "selfcheck_result", + "selfcheck_status", + "tropical_night_mode" + ] +} diff --git a/tests/fixtures/golden/airconditioner_tp2x_rac_20k.json b/tests/fixtures/golden/airconditioner_tp2x_rac_20k.json index cf11345..c419541 100644 --- a/tests/fixtures/golden/airconditioner_tp2x_rac_20k.json +++ b/tests/fixtures/golden/airconditioner_tp2x_rac_20k.json @@ -5,6 +5,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/airconditioner_windfree.json b/tests/fixtures/golden/airconditioner_windfree.json index 2407a44..95f4c8d 100644 --- a/tests/fixtures/golden/airconditioner_windfree.json +++ b/tests/fixtures/golden/airconditioner_windfree.json @@ -6,6 +6,8 @@ "air_purify", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "clean_level", "climate", diff --git a/tests/fixtures/golden/airconditioner_windfree_oscillation.json b/tests/fixtures/golden/airconditioner_windfree_oscillation.json index 2d75d0f..2c80427 100644 --- a/tests/fixtures/golden/airconditioner_windfree_oscillation.json +++ b/tests/fixtures/golden/airconditioner_windfree_oscillation.json @@ -6,6 +6,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/airconditioner_window_ac.json b/tests/fixtures/golden/airconditioner_window_ac.json index 904800b..58ac32d 100644 --- a/tests/fixtures/golden/airconditioner_window_ac.json +++ b/tests/fixtures/golden/airconditioner_window_ac.json @@ -5,6 +5,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "beep", "climate", "current_temperature_c", diff --git a/tests/fixtures/golden/dehumidifier.json b/tests/fixtures/golden/dehumidifier.json index ddaeb9d..b077657 100644 --- a/tests/fixtures/golden/dehumidifier.json +++ b/tests/fixtures/golden/dehumidifier.json @@ -6,6 +6,8 @@ "air_filter_usage_hours", "alarm_code", "auto_clean", + "auto_clean_progress", + "auto_clean_running", "energy_kwh", "energy_saved_kwh", "firmware_update",