From 0aedb015faa9c23aa35c83938b8ba184f7eaa2f6 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 9 Sep 2026 12:50:16 +0200 Subject: [PATCH] Use snapshot_platform in airzone (#181725) --- .../airzone/snapshots/test_climate.ambr | 661 +++++++++ .../airzone/snapshots/test_select.ambr | 1267 +++++++++++++++++ tests/components/airzone/test_climate.py | 228 +-- tests/components/airzone/test_select.py | 105 +- 4 files changed, 1994 insertions(+), 267 deletions(-) create mode 100644 tests/components/airzone/snapshots/test_climate.ambr create mode 100644 tests/components/airzone/snapshots/test_select.ambr diff --git a/tests/components/airzone/snapshots/test_climate.ambr b/tests/components/airzone/snapshots/test_climate.ambr new file mode 100644 index 000000000000..4d3005197ead --- /dev/null +++ b/tests/components/airzone/snapshots/test_climate.ambr @@ -0,0 +1,661 @@ +# serializer version: 1 +# name: test_airzone_create_climates[climate.airzone_2_1-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'auto', + 'low', + 'medium', + '75%', + 'high', + ]), + : list([ + , + , + ]), + : 30.0, + : 15.0, + : 0.5, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'climate', + 'entity_category': None, + 'entity_id': 'climate.airzone_2_1', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'airzone_unique_id_2:1', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_climates[climate.airzone_2_1-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 62, + : 22.3, + : 'auto', + : list([ + 'auto', + 'low', + 'medium', + '75%', + 'high', + ]), + : 'Airzone 2:1', + : , + : list([ + , + , + ]), + : 30.0, + : 15.0, + : , + : 0.5, + : 19.0, + }), + 'context': , + 'entity_id': 'climate.airzone_2_1', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_airzone_create_climates[climate.aux_heat-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : 0.5, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'climate', + 'entity_category': None, + 'entity_id': 'climate.aux_heat', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'airzone_unique_id_4:1', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_climates[climate.aux_heat-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 22.0, + : 'Aux Heat', + : , + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : , + : 0.5, + : 20.0, + }), + 'context': , + 'entity_id': 'climate.aux_heat', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'heat', + }) +# --- +# name: test_airzone_create_climates[climate.despacho-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'climate', + 'entity_category': None, + 'entity_id': 'climate.despacho', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'airzone_unique_id_1:4', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_climates[climate.despacho-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 36, + : 21.2, + : 'Despacho', + : , + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : , + : 1.0, + : 19.4, + }), + 'context': , + 'entity_id': 'climate.despacho', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_airzone_create_climates[climate.dkn_plus-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'auto', + 'low', + '40%', + 'medium', + '80%', + 'high', + ]), + : list([ + , + , + , + , + , + , + ]), + : 32.2, + : 17.8, + : 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'climate', + 'entity_category': None, + 'entity_id': 'climate.dkn_plus', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'airzone_unique_id_3:1', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_climates[climate.dkn_plus-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 21.7, + : '40%', + : list([ + 'auto', + 'low', + '40%', + 'medium', + '80%', + 'high', + ]), + : 'DKN Plus', + : , + : list([ + , + , + , + , + , + , + ]), + : 32.2, + : 17.8, + : , + : 25.0, + : 22.8, + : 1.0, + : None, + }), + 'context': , + 'entity_id': 'climate.dkn_plus', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'heat_cool', + }) +# --- +# name: test_airzone_create_climates[climate.dorm_1-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : 0.5, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'climate', + 'entity_category': None, + 'entity_id': 'climate.dorm_1', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'airzone_unique_id_1:3', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_climates[climate.dorm_1-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 35, + : 20.8, + : 'Dorm #1', + : , + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : , + : 0.5, + : 19.3, + }), + 'context': , + 'entity_id': 'climate.dorm_1', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'heat', + }) +# --- +# name: test_airzone_create_climates[climate.dorm_2-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : 0.5, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'climate', + 'entity_category': None, + 'entity_id': 'climate.dorm_2', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'airzone_unique_id_1:5', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_climates[climate.dorm_2-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 40, + : 20.5, + : 'Dorm #2', + : , + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : , + : 0.5, + : 19.5, + }), + 'context': , + 'entity_id': 'climate.dorm_2', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_airzone_create_climates[climate.dorm_ppal-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'auto', + 'low', + 'high', + ]), + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : 0.5, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'climate', + 'entity_category': None, + 'entity_id': 'climate.dorm_ppal', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'airzone_unique_id_1:2', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_climates[climate.dorm_ppal-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 39, + : 21.1, + : 'auto', + : list([ + 'auto', + 'low', + 'high', + ]), + : 'Dorm Ppal', + : , + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : , + : 0.5, + : 19.2, + }), + 'context': , + 'entity_id': 'climate.dorm_ppal', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'heat', + }) +# --- +# name: test_airzone_create_climates[climate.salon-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'auto', + 'low', + 'medium', + 'high', + ]), + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : 1.0, + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'climate', + 'entity_category': None, + 'entity_id': 'climate.salon', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': 'airzone_unique_id_1:1', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_climates[climate.salon-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 34, + : 19.6, + : 'auto', + : list([ + 'auto', + 'low', + 'medium', + 'high', + ]), + : 'Salon', + : , + : list([ + , + , + , + , + , + ]), + : 30.0, + : 15.0, + : , + : 1.0, + : 19.1, + }), + 'context': , + 'entity_id': 'climate.salon', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- diff --git a/tests/components/airzone/snapshots/test_select.ambr b/tests/components/airzone/snapshots/test_select.ambr new file mode 100644 index 000000000000..724643ba9d62 --- /dev/null +++ b/tests/components/airzone/snapshots/test_select.ambr @@ -0,0 +1,1267 @@ +# serializer version: 1 +# name: test_airzone_create_selects[select.airzone_2_1_mode-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'heat_cool', + 'stop', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': None, + 'entity_id': 'select.airzone_2_1_mode', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Mode', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Mode', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'modes', + 'unique_id': 'airzone_unique_id_2:1_mode', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.airzone_2_1_mode-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Airzone 2:1 Mode', + : list([ + 'heat_cool', + 'stop', + ]), + }), + 'context': , + 'entity_id': 'select.airzone_2_1_mode', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'heat_cool', + }) +# --- +# name: test_airzone_create_selects[select.aux_heat_mode-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'cool', + 'dry', + 'fan', + 'heat', + 'stop', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': None, + 'entity_id': 'select.aux_heat_mode', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Mode', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Mode', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'modes', + 'unique_id': 'airzone_unique_id_4:1_mode', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.aux_heat_mode-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Aux Heat Mode', + : list([ + 'cool', + 'dry', + 'fan', + 'heat', + 'stop', + ]), + }), + 'context': , + 'entity_id': 'select.aux_heat_mode', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_airzone_create_selects[select.despacho_cold_angle-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.despacho_cold_angle', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Cold angle', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Cold angle', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'grille_angles', + 'unique_id': 'airzone_unique_id_1:4_cold-angle', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.despacho_cold_angle-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Despacho Cold angle', + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'context': , + 'entity_id': 'select.despacho_cold_angle', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '90deg', + }) +# --- +# name: test_airzone_create_selects[select.despacho_heat_angle-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.despacho_heat_angle', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Heat angle', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Heat angle', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'heat_angles', + 'unique_id': 'airzone_unique_id_1:4_heat-angle', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.despacho_heat_angle-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Despacho Heat angle', + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'context': , + 'entity_id': 'select.despacho_heat_angle', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '90deg', + }) +# --- +# name: test_airzone_create_selects[select.despacho_sleep-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'off', + '30m', + '60m', + '90m', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.despacho_sleep', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Sleep', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Sleep', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'sleep_times', + 'unique_id': 'airzone_unique_id_1:4_sleep', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.despacho_sleep-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Despacho Sleep', + : list([ + 'off', + '30m', + '60m', + '90m', + ]), + }), + 'context': , + 'entity_id': 'select.despacho_sleep', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_airzone_create_selects[select.dkn_plus_mode-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'cool', + 'dry', + 'fan', + 'heat', + 'heat_cool', + 'stop', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': None, + 'entity_id': 'select.dkn_plus_mode', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Mode', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Mode', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'modes', + 'unique_id': 'airzone_unique_id_3:1_mode', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.dkn_plus_mode-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'DKN Plus Mode', + : list([ + 'cool', + 'dry', + 'fan', + 'heat', + 'heat_cool', + 'stop', + ]), + }), + 'context': , + 'entity_id': 'select.dkn_plus_mode', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'heat_cool', + }) +# --- +# name: test_airzone_create_selects[select.dorm_1_cold_angle-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.dorm_1_cold_angle', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Cold angle', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Cold angle', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'grille_angles', + 'unique_id': 'airzone_unique_id_1:3_cold-angle', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.dorm_1_cold_angle-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Dorm #1 Cold angle', + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'context': , + 'entity_id': 'select.dorm_1_cold_angle', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '90deg', + }) +# --- +# name: test_airzone_create_selects[select.dorm_1_heat_angle-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.dorm_1_heat_angle', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Heat angle', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Heat angle', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'heat_angles', + 'unique_id': 'airzone_unique_id_1:3_heat-angle', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.dorm_1_heat_angle-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Dorm #1 Heat angle', + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'context': , + 'entity_id': 'select.dorm_1_heat_angle', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '90deg', + }) +# --- +# name: test_airzone_create_selects[select.dorm_1_sleep-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'off', + '30m', + '60m', + '90m', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.dorm_1_sleep', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Sleep', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Sleep', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'sleep_times', + 'unique_id': 'airzone_unique_id_1:3_sleep', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.dorm_1_sleep-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Dorm #1 Sleep', + : list([ + 'off', + '30m', + '60m', + '90m', + ]), + }), + 'context': , + 'entity_id': 'select.dorm_1_sleep', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_airzone_create_selects[select.dorm_2_cold_angle-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.dorm_2_cold_angle', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Cold angle', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Cold angle', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'grille_angles', + 'unique_id': 'airzone_unique_id_1:5_cold-angle', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.dorm_2_cold_angle-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Dorm #2 Cold angle', + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'context': , + 'entity_id': 'select.dorm_2_cold_angle', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '90deg', + }) +# --- +# name: test_airzone_create_selects[select.dorm_2_heat_angle-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.dorm_2_heat_angle', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Heat angle', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Heat angle', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'heat_angles', + 'unique_id': 'airzone_unique_id_1:5_heat-angle', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.dorm_2_heat_angle-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Dorm #2 Heat angle', + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'context': , + 'entity_id': 'select.dorm_2_heat_angle', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '90deg', + }) +# --- +# name: test_airzone_create_selects[select.dorm_2_sleep-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'off', + '30m', + '60m', + '90m', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.dorm_2_sleep', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Sleep', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Sleep', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'sleep_times', + 'unique_id': 'airzone_unique_id_1:5_sleep', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.dorm_2_sleep-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Dorm #2 Sleep', + : list([ + 'off', + '30m', + '60m', + '90m', + ]), + }), + 'context': , + 'entity_id': 'select.dorm_2_sleep', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_airzone_create_selects[select.dorm_ppal_cold_angle-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.dorm_ppal_cold_angle', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Cold angle', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Cold angle', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'grille_angles', + 'unique_id': 'airzone_unique_id_1:2_cold-angle', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.dorm_ppal_cold_angle-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Dorm Ppal Cold angle', + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'context': , + 'entity_id': 'select.dorm_ppal_cold_angle', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '45deg', + }) +# --- +# name: test_airzone_create_selects[select.dorm_ppal_heat_angle-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.dorm_ppal_heat_angle', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Heat angle', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Heat angle', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'heat_angles', + 'unique_id': 'airzone_unique_id_1:2_heat-angle', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.dorm_ppal_heat_angle-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Dorm Ppal Heat angle', + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'context': , + 'entity_id': 'select.dorm_ppal_heat_angle', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '50deg', + }) +# --- +# name: test_airzone_create_selects[select.dorm_ppal_sleep-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'off', + '30m', + '60m', + '90m', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.dorm_ppal_sleep', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Sleep', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Sleep', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'sleep_times', + 'unique_id': 'airzone_unique_id_1:2_sleep', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.dorm_ppal_sleep-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Dorm Ppal Sleep', + : list([ + 'off', + '30m', + '60m', + '90m', + ]), + }), + 'context': , + 'entity_id': 'select.dorm_ppal_sleep', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '30m', + }) +# --- +# name: test_airzone_create_selects[select.salon_cold_angle-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.salon_cold_angle', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Cold angle', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Cold angle', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'grille_angles', + 'unique_id': 'airzone_unique_id_1:1_cold-angle', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.salon_cold_angle-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Salon Cold angle', + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'context': , + 'entity_id': 'select.salon_cold_angle', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '90deg', + }) +# --- +# name: test_airzone_create_selects[select.salon_heat_angle-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.salon_heat_angle', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Heat angle', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Heat angle', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'heat_angles', + 'unique_id': 'airzone_unique_id_1:1_heat-angle', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.salon_heat_angle-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Salon Heat angle', + : list([ + '90deg', + '50deg', + '45deg', + '40deg', + ]), + }), + 'context': , + 'entity_id': 'select.salon_heat_angle', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '90deg', + }) +# --- +# name: test_airzone_create_selects[select.salon_mode-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'cool', + 'dry', + 'fan', + 'heat', + 'stop', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': None, + 'entity_id': 'select.salon_mode', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Mode', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Mode', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'modes', + 'unique_id': 'airzone_unique_id_1:1_mode', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.salon_mode-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Salon Mode', + : list([ + 'cool', + 'dry', + 'fan', + 'heat', + 'stop', + ]), + }), + 'context': , + 'entity_id': 'select.salon_mode', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'heat', + }) +# --- +# name: test_airzone_create_selects[select.salon_sleep-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'off', + '30m', + '60m', + '90m', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.salon_sleep', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Sleep', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Sleep', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'sleep_times', + 'unique_id': 'airzone_unique_id_1:1_sleep', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.salon_sleep-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Salon Sleep', + : list([ + 'off', + '30m', + '60m', + '90m', + ]), + }), + 'context': , + 'entity_id': 'select.salon_sleep', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_airzone_create_selects[select.system_1_q_adapt-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'standard', + 'power', + 'silence', + 'minimum', + 'maximum', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'select', + 'entity_category': , + 'entity_id': 'select.system_1_q_adapt', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Q-Adapt', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Q-Adapt', + 'platform': 'airzone', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'q_adapt', + 'unique_id': 'airzone_unique_id_1_q-adapt', + 'unit_of_measurement': None, + }) +# --- +# name: test_airzone_create_selects[select.system_1_q_adapt-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'System 1 Q-Adapt', + : list([ + 'standard', + 'power', + 'silence', + 'minimum', + 'maximum', + ]), + }), + 'context': , + 'entity_id': 'select.system_1_q_adapt', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'standard', + }) +# --- diff --git a/tests/components/airzone/test_climate.py b/tests/components/airzone/test_climate.py index 7c08a5bc92c4..e73486981ee6 100644 --- a/tests/components/airzone/test_climate.py +++ b/tests/components/airzone/test_climate.py @@ -1,5 +1,6 @@ """The climate tests for the Airzone platform.""" +from collections.abc import Generator import copy from unittest.mock import patch @@ -18,30 +19,21 @@ from aioairzone.const import ( ) from aioairzone.exceptions import AirzoneError import pytest +from syrupy.assertion import SnapshotAssertion from homeassistant.components.airzone.coordinator import SCAN_INTERVAL from homeassistant.components.climate import ( - ATTR_CURRENT_HUMIDITY, - ATTR_CURRENT_TEMPERATURE, ATTR_FAN_MODE, - ATTR_FAN_MODES, - ATTR_HVAC_ACTION, ATTR_HVAC_MODE, - ATTR_HVAC_MODES, - ATTR_MAX_TEMP, - ATTR_MIN_TEMP, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, - ATTR_TARGET_TEMP_STEP, DOMAIN as CLIMATE_DOMAIN, - FAN_AUTO, - FAN_HIGH, - FAN_LOW, FAN_MEDIUM, SERVICE_SET_FAN_MODE, SERVICE_SET_HVAC_MODE, SERVICE_SET_TEMPERATURE, - HVACAction, + ClimateEntityCapabilityAttribute, + ClimateEntityStateAttribute, HVACMode, ) from homeassistant.const import ( @@ -49,9 +41,11 @@ from homeassistant.const import ( ATTR_TEMPERATURE, SERVICE_TURN_OFF, SERVICE_TURN_ON, + Platform, ) from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError +from homeassistant.helpers import entity_registry as er from homeassistant.util.dt import utcnow from .util import ( @@ -62,185 +56,33 @@ from .util import ( async_init_integration, ) -from tests.common import async_fire_time_changed +from tests.common import async_fire_time_changed, snapshot_platform -async def test_airzone_create_climates(hass: HomeAssistant) -> None: +@pytest.fixture(autouse=True) +def override_platforms() -> Generator[None]: + """Override PLATFORMS.""" + with patch("homeassistant.components.airzone.PLATFORMS", [Platform.CLIMATE]): + yield + + +async def test_airzone_create_climates( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, +) -> None: """Test creation of climates.""" + config_entry = await async_init_integration(hass) + + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) + + +async def test_airzone_climate_update_temp_limits(hass: HomeAssistant) -> None: + """Test climate temperature limits are refreshed from the API.""" + await async_init_integration(hass) - state = hass.states.get("climate.despacho") - assert state.state == HVACMode.OFF - assert state.attributes.get(ATTR_CURRENT_HUMIDITY) == 36 - assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) == 21.2 - assert state.attributes.get(ATTR_FAN_MODE) is None - assert state.attributes.get(ATTR_FAN_MODES) is None - assert state.attributes.get(ATTR_HVAC_ACTION) == HVACAction.OFF - assert state.attributes.get(ATTR_HVAC_MODES) == [ - HVACMode.OFF, - HVACMode.FAN_ONLY, - HVACMode.COOL, - HVACMode.HEAT, - HVACMode.DRY, - ] - assert state.attributes.get(ATTR_MAX_TEMP) == 30 - assert state.attributes.get(ATTR_MIN_TEMP) == 15 - assert state.attributes.get(ATTR_TARGET_TEMP_STEP) == 1.0 - assert state.attributes.get(ATTR_TEMPERATURE) == 19.4 - - state = hass.states.get("climate.dorm_1") - assert state.state == HVACMode.HEAT - assert state.attributes.get(ATTR_CURRENT_HUMIDITY) == 35 - assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) == 20.8 - assert state.attributes.get(ATTR_FAN_MODE) is None - assert state.attributes.get(ATTR_FAN_MODES) is None - assert state.attributes.get(ATTR_HVAC_ACTION) == HVACAction.IDLE - assert state.attributes.get(ATTR_HVAC_MODES) == [ - HVACMode.OFF, - HVACMode.FAN_ONLY, - HVACMode.COOL, - HVACMode.HEAT, - HVACMode.DRY, - ] - assert state.attributes.get(ATTR_MAX_TEMP) == 30 - assert state.attributes.get(ATTR_MIN_TEMP) == 15 - assert state.attributes.get(ATTR_TARGET_TEMP_STEP) == 0.5 - assert state.attributes.get(ATTR_TEMPERATURE) == 19.3 - - state = hass.states.get("climate.dorm_2") - assert state.state == HVACMode.OFF - assert state.attributes.get(ATTR_CURRENT_HUMIDITY) == 40 - assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) == 20.5 - assert state.attributes.get(ATTR_FAN_MODE) is None - assert state.attributes.get(ATTR_FAN_MODES) is None - assert state.attributes.get(ATTR_HVAC_ACTION) == HVACAction.OFF - assert state.attributes.get(ATTR_HVAC_MODES) == [ - HVACMode.OFF, - HVACMode.FAN_ONLY, - HVACMode.COOL, - HVACMode.HEAT, - HVACMode.DRY, - ] - assert state.attributes.get(ATTR_MAX_TEMP) == 30 - assert state.attributes.get(ATTR_MIN_TEMP) == 15 - assert state.attributes.get(ATTR_TARGET_TEMP_STEP) == 0.5 - assert state.attributes.get(ATTR_TEMPERATURE) == 19.5 - - state = hass.states.get("climate.dorm_ppal") - assert state.state == HVACMode.HEAT - assert state.attributes.get(ATTR_CURRENT_HUMIDITY) == 39 - assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) == 21.1 - assert state.attributes.get(ATTR_FAN_MODE) == FAN_AUTO - assert state.attributes.get(ATTR_FAN_MODES) == [ - FAN_AUTO, - FAN_LOW, - FAN_HIGH, - ] - assert state.attributes.get(ATTR_HVAC_ACTION) == HVACAction.HEATING - assert state.attributes.get(ATTR_HVAC_MODES) == [ - HVACMode.OFF, - HVACMode.FAN_ONLY, - HVACMode.COOL, - HVACMode.HEAT, - HVACMode.DRY, - ] - assert state.attributes.get(ATTR_MAX_TEMP) == 30 - assert state.attributes.get(ATTR_MIN_TEMP) == 15 - assert state.attributes.get(ATTR_TARGET_TEMP_STEP) == 0.5 - assert state.attributes.get(ATTR_TEMPERATURE) == 19.2 - - state = hass.states.get("climate.salon") - assert state.state == HVACMode.OFF - assert state.attributes.get(ATTR_CURRENT_HUMIDITY) == 34 - assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) == 19.6 - assert state.attributes.get(ATTR_FAN_MODE) == FAN_AUTO - assert state.attributes.get(ATTR_FAN_MODES) == [ - FAN_AUTO, - FAN_LOW, - FAN_MEDIUM, - FAN_HIGH, - ] - assert state.attributes.get(ATTR_HVAC_ACTION) == HVACAction.OFF - assert state.attributes.get(ATTR_HVAC_MODES) == [ - HVACMode.OFF, - HVACMode.FAN_ONLY, - HVACMode.COOL, - HVACMode.HEAT, - HVACMode.DRY, - ] - assert state.attributes.get(ATTR_MAX_TEMP) == 30 - assert state.attributes.get(ATTR_MIN_TEMP) == 15 - assert state.attributes.get(ATTR_TARGET_TEMP_STEP) == 1.0 - assert state.attributes.get(ATTR_TEMPERATURE) == 19.1 - - state = hass.states.get("climate.airzone_2_1") - assert state.state == HVACMode.OFF - assert state.attributes.get(ATTR_CURRENT_HUMIDITY) == 62 - assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) == 22.3 - assert state.attributes.get(ATTR_FAN_MODE) == FAN_AUTO - assert state.attributes.get(ATTR_FAN_MODES) == [ - FAN_AUTO, - FAN_LOW, - FAN_MEDIUM, - "75%", - FAN_HIGH, - ] - assert state.attributes.get(ATTR_HVAC_ACTION) == HVACAction.OFF - assert state.attributes.get(ATTR_HVAC_MODES) == [ - HVACMode.HEAT_COOL, - HVACMode.OFF, - ] - assert state.attributes.get(ATTR_MAX_TEMP) == 30 - assert state.attributes.get(ATTR_MIN_TEMP) == 15 - assert state.attributes.get(ATTR_TARGET_TEMP_STEP) == 0.5 - assert state.attributes.get(ATTR_TEMPERATURE) == 19.0 - - state = hass.states.get("climate.dkn_plus") - assert state.state == HVACMode.HEAT_COOL - assert state.attributes.get(ATTR_CURRENT_HUMIDITY) is None - assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) == 21.7 - assert state.attributes.get(ATTR_FAN_MODE) == "40%" - assert state.attributes.get(ATTR_FAN_MODES) == [ - FAN_AUTO, - FAN_LOW, - "40%", - FAN_MEDIUM, - "80%", - FAN_HIGH, - ] - assert state.attributes.get(ATTR_HVAC_ACTION) == HVACAction.COOLING - assert state.attributes.get(ATTR_HVAC_MODES) == [ - HVACMode.FAN_ONLY, - HVACMode.COOL, - HVACMode.HEAT, - HVACMode.DRY, - HVACMode.HEAT_COOL, - HVACMode.OFF, - ] - assert state.attributes.get(ATTR_MAX_TEMP) == 32.2 - assert state.attributes.get(ATTR_MIN_TEMP) == 17.8 - assert state.attributes.get(ATTR_TARGET_TEMP_STEP) == 1.0 - assert state.attributes.get(ATTR_TARGET_TEMP_HIGH) == 25.0 - assert state.attributes.get(ATTR_TARGET_TEMP_LOW) == 22.8 - - state = hass.states.get("climate.aux_heat") - assert state.state == HVACMode.HEAT - assert state.attributes.get(ATTR_CURRENT_HUMIDITY) is None - assert state.attributes.get(ATTR_CURRENT_TEMPERATURE) == 22 - assert state.attributes.get(ATTR_HVAC_ACTION) == HVACAction.IDLE - assert state.attributes.get(ATTR_HVAC_MODES) == [ - HVACMode.OFF, - HVACMode.COOL, - HVACMode.HEAT, - HVACMode.FAN_ONLY, - HVACMode.DRY, - ] - assert state.attributes.get(ATTR_MAX_TEMP) == 30 - assert state.attributes.get(ATTR_MIN_TEMP) == 15 - assert state.attributes.get(ATTR_TARGET_TEMP_STEP) == 0.5 - assert state.attributes.get(ATTR_TEMPERATURE) == 20.0 - HVAC_MOCK_CHANGED = copy.deepcopy(HVAC_MOCK) HVAC_MOCK_CHANGED[API_SYSTEMS][0][API_DATA][0][API_MAX_TEMP] = 25 HVAC_MOCK_CHANGED[API_SYSTEMS][0][API_DATA][0][API_MIN_TEMP] = 10 @@ -267,8 +109,8 @@ async def test_airzone_create_climates(hass: HomeAssistant) -> None: await hass.async_block_till_done(wait_background_tasks=True) state = hass.states.get("climate.salon") - assert state.attributes.get(ATTR_MAX_TEMP) == 25 - assert state.attributes.get(ATTR_MIN_TEMP) == 10 + assert state.attributes.get(ClimateEntityCapabilityAttribute.MAX_TEMP) == 25 + assert state.attributes.get(ClimateEntityCapabilityAttribute.MIN_TEMP) == 10 async def test_airzone_climate_turn_on_off(hass: HomeAssistant) -> None: @@ -486,7 +328,7 @@ async def test_airzone_climate_set_hvac_mode(hass: HomeAssistant) -> None: await hass.async_block_till_done() state = hass.states.get("climate.salon") - assert state.attributes.get(ATTR_TEMPERATURE) == 19.1 + assert state.attributes.get(ClimateEntityStateAttribute.TARGET_TEMPERATURE) == 19.1 async def test_airzone_climate_set_hvac_slave_error(hass: HomeAssistant) -> None: @@ -555,7 +397,7 @@ async def test_airzone_climate_set_fan_mode(hass: HomeAssistant) -> None: ) state = hass.states.get("climate.salon") - assert state.attributes.get(ATTR_FAN_MODE) == FAN_MEDIUM + assert state.attributes.get(ClimateEntityStateAttribute.FAN_MODE) == FAN_MEDIUM async def test_airzone_climate_set_temp(hass: HomeAssistant) -> None: @@ -591,7 +433,7 @@ async def test_airzone_climate_set_temp(hass: HomeAssistant) -> None: state = hass.states.get("climate.dorm_2") assert state.state == HVACMode.HEAT - assert state.attributes.get(ATTR_TEMPERATURE) == 20.5 + assert state.attributes.get(ClimateEntityStateAttribute.TARGET_TEMPERATURE) == 20.5 async def test_airzone_climate_set_temp_error(hass: HomeAssistant) -> None: @@ -617,7 +459,7 @@ async def test_airzone_climate_set_temp_error(hass: HomeAssistant) -> None: ) state = hass.states.get("climate.dorm_2") - assert state.attributes.get(ATTR_TEMPERATURE) == 19.5 + assert state.attributes.get(ClimateEntityStateAttribute.TARGET_TEMPERATURE) == 19.5 async def test_airzone_climate_set_temp_range(hass: HomeAssistant) -> None: @@ -652,5 +494,5 @@ async def test_airzone_climate_set_temp_range(hass: HomeAssistant) -> None: ) state = hass.states.get("climate.dkn_plus") - assert state.attributes.get(ATTR_TARGET_TEMP_HIGH) == 25.0 - assert state.attributes.get(ATTR_TARGET_TEMP_LOW) == 20.0 + assert state.attributes.get(ClimateEntityStateAttribute.TARGET_TEMP_HIGH) == 25.0 + assert state.attributes.get(ClimateEntityStateAttribute.TARGET_TEMP_LOW) == 20.0 diff --git a/tests/components/airzone/test_select.py b/tests/components/airzone/test_select.py index 4421822f1c89..4e3a7e4973eb 100644 --- a/tests/components/airzone/test_select.py +++ b/tests/components/airzone/test_select.py @@ -1,5 +1,6 @@ """The select tests for the Airzone platform.""" +from collections.abc import Generator from unittest.mock import patch from aioairzone.common import OperationMode, QAdapt @@ -14,91 +15,47 @@ from aioairzone.const import ( API_ZONE_ID, ) import pytest +from syrupy.assertion import SnapshotAssertion -from homeassistant.components.select import ATTR_OPTIONS, DOMAIN as SELECT_DOMAIN -from homeassistant.const import ATTR_ENTITY_ID, ATTR_OPTION, SERVICE_SELECT_OPTION +from homeassistant.components.select import DOMAIN as SELECT_DOMAIN +from homeassistant.const import ( + ATTR_ENTITY_ID, + ATTR_OPTION, + SERVICE_SELECT_OPTION, + Platform, +) from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError, ServiceValidationError +from homeassistant.helpers import entity_registry as er from .util import async_init_integration +from tests.common import snapshot_platform -async def test_airzone_create_selects(hass: HomeAssistant) -> None: + +@pytest.fixture(autouse=True) +def override_platforms() -> Generator[None]: + """Override PLATFORMS.""" + with patch("homeassistant.components.airzone.PLATFORMS", [Platform.SELECT]): + yield + + +async def test_airzone_create_selects( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, +) -> None: """Test creation of selects.""" - await async_init_integration(hass) + config_entry = await async_init_integration(hass) - # Systems - state = hass.states.get("select.system_1_q_adapt") - assert state.state == "standard" + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) - # Zones - state = hass.states.get("select.despacho_cold_angle") - assert state.state == "90deg" - - state = hass.states.get("select.despacho_heat_angle") - assert state.state == "90deg" - - state = hass.states.get("select.despacho_mode") - assert state is None - - state = hass.states.get("select.despacho_sleep") - assert state.state == "off" - - state = hass.states.get("select.dorm_1_cold_angle") - assert state.state == "90deg" - - state = hass.states.get("select.dorm_1_heat_angle") - assert state.state == "90deg" - - state = hass.states.get("select.dorm_1_mode") - assert state is None - - state = hass.states.get("select.dorm_1_sleep") - assert state.state == "off" - - state = hass.states.get("select.dorm_2_cold_angle") - assert state.state == "90deg" - - state = hass.states.get("select.dorm_2_heat_angle") - assert state.state == "90deg" - - state = hass.states.get("select.dorm_2_mode") - assert state is None - - state = hass.states.get("select.dorm_2_sleep") - assert state.state == "off" - - state = hass.states.get("select.dorm_ppal_cold_angle") - assert state.state == "45deg" - - state = hass.states.get("select.dorm_ppal_heat_angle") - assert state.state == "50deg" - - state = hass.states.get("select.dorm_ppal_mode") - assert state is None - - state = hass.states.get("select.dorm_ppal_sleep") - assert state.state == "30m" - - state = hass.states.get("select.salon_cold_angle") - assert state.state == "90deg" - - state = hass.states.get("select.salon_heat_angle") - assert state.state == "90deg" - - state = hass.states.get("select.salon_mode") - assert state.state == "heat" - assert state.attributes.get(ATTR_OPTIONS) == [ - "cool", - "dry", - "fan", - "heat", - "stop", - ] - - state = hass.states.get("select.salon_sleep") - assert state.state == "off" + # Mode selects are only created for master zones + assert hass.states.get("select.despacho_mode") is None + assert hass.states.get("select.dorm_1_mode") is None + assert hass.states.get("select.dorm_2_mode") is None + assert hass.states.get("select.dorm_ppal_mode") is None async def test_airzone_select_sys_qadapt(hass: HomeAssistant) -> None: