From 919823446580594411863e6429a13e02d2d99271 Mon Sep 17 00:00:00 2001 From: Robert Svensson Date: Wed, 24 Jul 2024 20:08:42 +0200 Subject: [PATCH] Use snapshot in deCONZ light tests (#122548) --- .../deconz/snapshots/test_light.ambr | 2971 +++++++++++++++++ tests/components/deconz/test_light.py | 256 +- 2 files changed, 3002 insertions(+), 225 deletions(-) create mode 100644 tests/components/deconz/snapshots/test_light.ambr diff --git a/tests/components/deconz/snapshots/test_light.ambr b/tests/components/deconz/snapshots/test_light.ambr new file mode 100644 index 00000000000..46b6611dcbe --- /dev/null +++ b/tests/components/deconz/snapshots/test_light.ambr @@ -0,0 +1,2971 @@ +# serializer version: 1 +# name: test_groups[input0-expected0-light_payload0][light.dimmable_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.dimmable_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Dimmable light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:02-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input0-expected0-light_payload0][light.dimmable_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 255, + 'color_mode': , + 'friendly_name': 'Dimmable light', + 'is_deconz_group': False, + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.dimmable_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input0-expected0-light_payload0][light.group-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.group', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '01234E56789A-/groups/0', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input0-expected0-light_payload0][light.group-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'all_on': False, + 'brightness': 255, + 'color_mode': , + 'color_temp': 2500, + 'color_temp_kelvin': 400, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Group', + 'hs_color': tuple( + 15.981, + 100.0, + ), + 'is_deconz_group': True, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'rgb_color': tuple( + 255, + 67, + 0, + ), + 'supported_color_modes': list([ + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.674, + 0.322, + ), + }), + 'context': , + 'entity_id': 'light.group', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input0-expected0-light_payload0][light.rgb_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.rgb_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'RGB light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:00-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input0-expected0-light_payload0][light.rgb_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 50, + 'color_mode': , + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'RGB light', + 'hs_color': tuple( + 52.0, + 100.0, + ), + 'is_deconz_group': False, + 'rgb_color': tuple( + 255, + 221, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.5, + 0.5, + ), + }), + 'context': , + 'entity_id': 'light.rgb_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input0-expected0-light_payload0][light.tunable_white_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.tunable_white_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Tunable white light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:01-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input0-expected0-light_payload0][light.tunable_white_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': None, + 'color_mode': , + 'color_temp': 2500, + 'color_temp_kelvin': 400, + 'friendly_name': 'Tunable white light', + 'hs_color': tuple( + 15.981, + 100.0, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'rgb_color': tuple( + 255, + 67, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.674, + 0.322, + ), + }), + 'context': , + 'entity_id': 'light.tunable_white_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input0-light_payload0][light.dimmable_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.dimmable_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Dimmable light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:02-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input0-light_payload0][light.dimmable_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 255, + 'color_mode': , + 'friendly_name': 'Dimmable light', + 'is_deconz_group': False, + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.dimmable_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input0-light_payload0][light.group-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.group', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '01234E56789A-/groups/0', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input0-light_payload0][light.group-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'all_on': False, + 'brightness': 255, + 'color_mode': , + 'color_temp': 2500, + 'color_temp_kelvin': 400, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Group', + 'hs_color': tuple( + 15.981, + 100.0, + ), + 'is_deconz_group': True, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'rgb_color': tuple( + 255, + 67, + 0, + ), + 'supported_color_modes': list([ + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.674, + 0.322, + ), + }), + 'context': , + 'entity_id': 'light.group', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input0-light_payload0][light.rgb_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.rgb_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'RGB light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:00-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input0-light_payload0][light.rgb_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 50, + 'color_mode': , + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'RGB light', + 'hs_color': tuple( + 52.0, + 100.0, + ), + 'is_deconz_group': False, + 'rgb_color': tuple( + 255, + 221, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.5, + 0.5, + ), + }), + 'context': , + 'entity_id': 'light.rgb_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input0-light_payload0][light.tunable_white_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.tunable_white_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Tunable white light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:01-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input0-light_payload0][light.tunable_white_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': None, + 'color_mode': , + 'color_temp': 2500, + 'color_temp_kelvin': 400, + 'friendly_name': 'Tunable white light', + 'hs_color': tuple( + 15.981, + 100.0, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'rgb_color': tuple( + 255, + 67, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.674, + 0.322, + ), + }), + 'context': , + 'entity_id': 'light.tunable_white_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input1-expected1-light_payload0][light.dimmable_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.dimmable_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Dimmable light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:02-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input1-expected1-light_payload0][light.dimmable_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 255, + 'color_mode': , + 'friendly_name': 'Dimmable light', + 'is_deconz_group': False, + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.dimmable_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input1-expected1-light_payload0][light.group-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.group', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '01234E56789A-/groups/0', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input1-expected1-light_payload0][light.group-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'all_on': False, + 'brightness': 50, + 'color_mode': , + 'color_temp': 2500, + 'color_temp_kelvin': 400, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Group', + 'hs_color': tuple( + 15.981, + 100.0, + ), + 'is_deconz_group': True, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'rgb_color': tuple( + 255, + 67, + 0, + ), + 'supported_color_modes': list([ + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.674, + 0.322, + ), + }), + 'context': , + 'entity_id': 'light.group', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input1-expected1-light_payload0][light.rgb_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.rgb_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'RGB light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:00-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input1-expected1-light_payload0][light.rgb_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 50, + 'color_mode': , + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'RGB light', + 'hs_color': tuple( + 52.0, + 100.0, + ), + 'is_deconz_group': False, + 'rgb_color': tuple( + 255, + 221, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.5, + 0.5, + ), + }), + 'context': , + 'entity_id': 'light.rgb_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input1-expected1-light_payload0][light.tunable_white_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.tunable_white_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Tunable white light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:01-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input1-expected1-light_payload0][light.tunable_white_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': None, + 'color_mode': , + 'color_temp': 2500, + 'color_temp_kelvin': 400, + 'friendly_name': 'Tunable white light', + 'hs_color': tuple( + 15.981, + 100.0, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'rgb_color': tuple( + 255, + 67, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.674, + 0.322, + ), + }), + 'context': , + 'entity_id': 'light.tunable_white_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input1-light_payload0][light.dimmable_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.dimmable_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Dimmable light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:02-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input1-light_payload0][light.dimmable_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 255, + 'color_mode': , + 'friendly_name': 'Dimmable light', + 'is_deconz_group': False, + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.dimmable_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input1-light_payload0][light.group-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.group', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '01234E56789A-/groups/0', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input1-light_payload0][light.group-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'all_on': False, + 'brightness': 50, + 'color_mode': , + 'color_temp': 2500, + 'color_temp_kelvin': 400, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Group', + 'hs_color': tuple( + 15.981, + 100.0, + ), + 'is_deconz_group': True, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'rgb_color': tuple( + 255, + 67, + 0, + ), + 'supported_color_modes': list([ + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.674, + 0.322, + ), + }), + 'context': , + 'entity_id': 'light.group', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input1-light_payload0][light.rgb_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.rgb_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'RGB light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:00-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input1-light_payload0][light.rgb_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 50, + 'color_mode': , + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'RGB light', + 'hs_color': tuple( + 52.0, + 100.0, + ), + 'is_deconz_group': False, + 'rgb_color': tuple( + 255, + 221, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.5, + 0.5, + ), + }), + 'context': , + 'entity_id': 'light.rgb_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input1-light_payload0][light.tunable_white_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.tunable_white_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Tunable white light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:01-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input1-light_payload0][light.tunable_white_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': None, + 'color_mode': , + 'color_temp': 2500, + 'color_temp_kelvin': 400, + 'friendly_name': 'Tunable white light', + 'hs_color': tuple( + 15.981, + 100.0, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'rgb_color': tuple( + 255, + 67, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.674, + 0.322, + ), + }), + 'context': , + 'entity_id': 'light.tunable_white_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input2-expected2-light_payload0][light.dimmable_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.dimmable_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Dimmable light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:02-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input2-expected2-light_payload0][light.dimmable_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 255, + 'color_mode': , + 'friendly_name': 'Dimmable light', + 'is_deconz_group': False, + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.dimmable_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input2-expected2-light_payload0][light.group-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.group', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '01234E56789A-/groups/0', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input2-expected2-light_payload0][light.group-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'all_on': False, + 'brightness': 50, + 'color_mode': , + 'color_temp': None, + 'color_temp_kelvin': None, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Group', + 'hs_color': tuple( + 52.0, + 100.0, + ), + 'is_deconz_group': True, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'rgb_color': tuple( + 255, + 221, + 0, + ), + 'supported_color_modes': list([ + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.5, + 0.5, + ), + }), + 'context': , + 'entity_id': 'light.group', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input2-expected2-light_payload0][light.rgb_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.rgb_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'RGB light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:00-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input2-expected2-light_payload0][light.rgb_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 50, + 'color_mode': , + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'RGB light', + 'hs_color': tuple( + 52.0, + 100.0, + ), + 'is_deconz_group': False, + 'rgb_color': tuple( + 255, + 221, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.5, + 0.5, + ), + }), + 'context': , + 'entity_id': 'light.rgb_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input2-expected2-light_payload0][light.tunable_white_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.tunable_white_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Tunable white light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:01-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input2-expected2-light_payload0][light.tunable_white_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': None, + 'color_mode': , + 'color_temp': 2500, + 'color_temp_kelvin': 400, + 'friendly_name': 'Tunable white light', + 'hs_color': tuple( + 15.981, + 100.0, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'rgb_color': tuple( + 255, + 67, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.674, + 0.322, + ), + }), + 'context': , + 'entity_id': 'light.tunable_white_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input2-light_payload0][light.dimmable_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.dimmable_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Dimmable light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:02-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input2-light_payload0][light.dimmable_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 255, + 'color_mode': , + 'friendly_name': 'Dimmable light', + 'is_deconz_group': False, + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.dimmable_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input2-light_payload0][light.group-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.group', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '01234E56789A-/groups/0', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input2-light_payload0][light.group-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'all_on': False, + 'brightness': 50, + 'color_mode': , + 'color_temp': None, + 'color_temp_kelvin': None, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Group', + 'hs_color': tuple( + 52.0, + 100.0, + ), + 'is_deconz_group': True, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'rgb_color': tuple( + 255, + 221, + 0, + ), + 'supported_color_modes': list([ + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.5, + 0.5, + ), + }), + 'context': , + 'entity_id': 'light.group', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input2-light_payload0][light.rgb_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.rgb_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'RGB light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:00-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input2-light_payload0][light.rgb_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 50, + 'color_mode': , + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'RGB light', + 'hs_color': tuple( + 52.0, + 100.0, + ), + 'is_deconz_group': False, + 'rgb_color': tuple( + 255, + 221, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.5, + 0.5, + ), + }), + 'context': , + 'entity_id': 'light.rgb_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_groups[input2-light_payload0][light.tunable_white_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.tunable_white_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Tunable white light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '00:00:00:00:00:00:00:01-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_groups[input2-light_payload0][light.tunable_white_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': None, + 'color_mode': , + 'color_temp': 2500, + 'color_temp_kelvin': 400, + 'friendly_name': 'Tunable white light', + 'hs_color': tuple( + 15.981, + 100.0, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6451, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 155, + 'rgb_color': tuple( + 255, + 67, + 0, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.674, + 0.322, + ), + }), + 'context': , + 'entity_id': 'light.tunable_white_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload0-expected0][light.hue_go-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.hue_go', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Hue Go', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:17:88:01:01:23:45:67-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload0-expected0][light.hue_go-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 254, + 'color_mode': , + 'color_temp': 375, + 'color_temp_kelvin': 2666, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Hue Go', + 'hs_color': tuple( + 28.47, + 66.821, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'rgb_color': tuple( + 255, + 165, + 84, + ), + 'supported_color_modes': list([ + , + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.53, + 0.388, + ), + }), + 'context': , + 'entity_id': 'light.hue_go', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload0][light.hue_go-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.hue_go', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Hue Go', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:17:88:01:01:23:45:67-00', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload0][light.hue_go-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 254, + 'color_mode': , + 'color_temp': 375, + 'color_temp_kelvin': 2666, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Hue Go', + 'hs_color': tuple( + 28.47, + 66.821, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'rgb_color': tuple( + 255, + 165, + 84, + ), + 'supported_color_modes': list([ + , + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.53, + 0.388, + ), + }), + 'context': , + 'entity_id': 'light.hue_go', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload1-expected1][light.hue_ensis-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 7142, + 'max_mireds': 650, + 'min_color_temp_kelvin': 1538, + 'min_mireds': 140, + 'supported_color_modes': list([ + , + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.hue_ensis', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Hue Ensis', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:17:88:01:01:23:45:67-01', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload1-expected1][light.hue_ensis-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 254, + 'color_mode': , + 'color_temp': None, + 'color_temp_kelvin': None, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Hue Ensis', + 'hs_color': tuple( + 29.691, + 38.039, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 7142, + 'max_mireds': 650, + 'min_color_temp_kelvin': 1538, + 'min_mireds': 140, + 'rgb_color': tuple( + 255, + 206, + 158, + ), + 'supported_color_modes': list([ + , + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.427, + 0.373, + ), + }), + 'context': , + 'entity_id': 'light.hue_ensis', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload1][light.hue_ensis-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 7142, + 'max_mireds': 650, + 'min_color_temp_kelvin': 1538, + 'min_mireds': 140, + 'supported_color_modes': list([ + , + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.hue_ensis', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Hue Ensis', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:17:88:01:01:23:45:67-01', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload1][light.hue_ensis-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 254, + 'color_mode': , + 'color_temp': None, + 'color_temp_kelvin': None, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Hue Ensis', + 'hs_color': tuple( + 29.691, + 38.039, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 7142, + 'max_mireds': 650, + 'min_color_temp_kelvin': 1538, + 'min_mireds': 140, + 'rgb_color': tuple( + 255, + 206, + 158, + ), + 'supported_color_modes': list([ + , + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.427, + 0.373, + ), + }), + 'context': , + 'entity_id': 'light.hue_ensis', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload2-expected2][light.lidl_xmas_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'carnival', + 'collide', + 'fading', + 'fireworks', + 'flag', + 'glow', + 'rainbow', + 'snake', + 'snow', + 'sparkles', + 'steady', + 'strobe', + 'twinkle', + 'updown', + 'vintage', + 'waves', + ]), + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.lidl_xmas_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'LIDL xmas light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '58:8e:81:ff:fe:db:7b:be-01', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload2-expected2][light.lidl_xmas_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 25, + 'color_mode': , + 'effect': None, + 'effect_list': list([ + 'carnival', + 'collide', + 'fading', + 'fireworks', + 'flag', + 'glow', + 'rainbow', + 'snake', + 'snow', + 'sparkles', + 'steady', + 'strobe', + 'twinkle', + 'updown', + 'vintage', + 'waves', + ]), + 'friendly_name': 'LIDL xmas light', + 'hs_color': tuple( + 294.938, + 55.294, + ), + 'is_deconz_group': False, + 'rgb_color': tuple( + 243, + 113, + 255, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.357, + 0.188, + ), + }), + 'context': , + 'entity_id': 'light.lidl_xmas_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload2][light.lidl_xmas_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'carnival', + 'collide', + 'fading', + 'fireworks', + 'flag', + 'glow', + 'rainbow', + 'snake', + 'snow', + 'sparkles', + 'steady', + 'strobe', + 'twinkle', + 'updown', + 'vintage', + 'waves', + ]), + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.lidl_xmas_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'LIDL xmas light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '58:8e:81:ff:fe:db:7b:be-01', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload2][light.lidl_xmas_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 25, + 'color_mode': , + 'effect': None, + 'effect_list': list([ + 'carnival', + 'collide', + 'fading', + 'fireworks', + 'flag', + 'glow', + 'rainbow', + 'snake', + 'snow', + 'sparkles', + 'steady', + 'strobe', + 'twinkle', + 'updown', + 'vintage', + 'waves', + ]), + 'friendly_name': 'LIDL xmas light', + 'hs_color': tuple( + 294.938, + 55.294, + ), + 'is_deconz_group': False, + 'rgb_color': tuple( + 243, + 113, + 255, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.357, + 0.188, + ), + }), + 'context': , + 'entity_id': 'light.lidl_xmas_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload3-expected3][light.hue_white_ambiance-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max_color_temp_kelvin': 6535, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.hue_white_ambiance', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Hue White Ambiance', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:17:88:01:01:23:45:67-02', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload3-expected3][light.hue_white_ambiance-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 254, + 'color_mode': , + 'color_temp': 396, + 'color_temp_kelvin': 2525, + 'friendly_name': 'Hue White Ambiance', + 'hs_color': tuple( + 28.809, + 71.624, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 153, + 'rgb_color': tuple( + 255, + 160, + 72, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.544, + 0.389, + ), + }), + 'context': , + 'entity_id': 'light.hue_white_ambiance', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload3][light.hue_white_ambiance-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'max_color_temp_kelvin': 6535, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.hue_white_ambiance', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Hue White Ambiance', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:17:88:01:01:23:45:67-02', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload3][light.hue_white_ambiance-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 254, + 'color_mode': , + 'color_temp': 396, + 'color_temp_kelvin': 2525, + 'friendly_name': 'Hue White Ambiance', + 'hs_color': tuple( + 28.809, + 71.624, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 454, + 'min_color_temp_kelvin': 2202, + 'min_mireds': 153, + 'rgb_color': tuple( + 255, + 160, + 72, + ), + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.544, + 0.389, + ), + }), + 'context': , + 'entity_id': 'light.hue_white_ambiance', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload4-expected4][light.hue_filament-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.hue_filament', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Hue Filament', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:17:88:01:01:23:45:67-03', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload4-expected4][light.hue_filament-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 254, + 'color_mode': , + 'friendly_name': 'Hue Filament', + 'is_deconz_group': False, + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.hue_filament', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload4][light.hue_filament-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.hue_filament', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Hue Filament', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:17:88:01:01:23:45:67-03', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload4][light.hue_filament-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 254, + 'color_mode': , + 'friendly_name': 'Hue Filament', + 'is_deconz_group': False, + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.hue_filament', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload5-expected5][light.simple_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.simple_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Simple Light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '00:15:8d:00:01:23:45:67-01', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload5-expected5][light.simple_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'color_mode': , + 'friendly_name': 'Simple Light', + 'is_deconz_group': False, + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.simple_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload5][light.simple_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.simple_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Simple Light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '00:15:8d:00:01:23:45:67-01', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload5][light.simple_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'color_mode': , + 'friendly_name': 'Simple Light', + 'is_deconz_group': False, + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.simple_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload6-expected6][light.gradient_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.gradient_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Gradient light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:17:88:01:0b:0c:0d:0e-0f', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload6-expected6][light.gradient_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 184, + 'color_mode': , + 'color_temp': None, + 'color_temp_kelvin': None, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Gradient light', + 'hs_color': tuple( + 98.095, + 74.118, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'rgb_color': tuple( + 135, + 255, + 66, + ), + 'supported_color_modes': list([ + , + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.2727, + 0.6226, + ), + }), + 'context': , + 'entity_id': 'light.gradient_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_lights[light_payload6][light.gradient_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'effect_list': list([ + 'colorloop', + ]), + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'supported_color_modes': list([ + , + , + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.gradient_light', + 'has_entity_name': False, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Gradient light', + 'platform': 'deconz', + 'previous_unique_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '00:17:88:01:0b:0c:0d:0e-0f', + 'unit_of_measurement': None, + }) +# --- +# name: test_lights[light_payload6][light.gradient_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'brightness': 184, + 'color_mode': , + 'color_temp': None, + 'color_temp_kelvin': None, + 'effect': None, + 'effect_list': list([ + 'colorloop', + ]), + 'friendly_name': 'Gradient light', + 'hs_color': tuple( + 98.095, + 74.118, + ), + 'is_deconz_group': False, + 'max_color_temp_kelvin': 6535, + 'max_mireds': 500, + 'min_color_temp_kelvin': 2000, + 'min_mireds': 153, + 'rgb_color': tuple( + 135, + 255, + 66, + ), + 'supported_color_modes': list([ + , + , + , + ]), + 'supported_features': , + 'xy_color': tuple( + 0.2727, + 0.6226, + ), + }), + 'context': , + 'entity_id': 'light.gradient_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- diff --git a/tests/components/deconz/test_light.py b/tests/components/deconz/test_light.py index 750661a8ba7..7bc2d961d13 100644 --- a/tests/components/deconz/test_light.py +++ b/tests/components/deconz/test_light.py @@ -2,22 +2,19 @@ from collections.abc import Callable from typing import Any +from unittest.mock import patch import pytest +from syrupy import SnapshotAssertion -from homeassistant.components.deconz.const import ATTR_ON, CONF_ALLOW_DECONZ_GROUPS -from homeassistant.components.deconz.light import DECONZ_GROUP +from homeassistant.components.deconz.const import CONF_ALLOW_DECONZ_GROUPS from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_COLOR_MODE, ATTR_COLOR_TEMP, ATTR_EFFECT, - ATTR_EFFECT_LIST, ATTR_FLASH, ATTR_HS_COLOR, - ATTR_MAX_MIREDS, - ATTR_MIN_MIREDS, - ATTR_RGB_COLOR, ATTR_SUPPORTED_COLOR_MODES, ATTR_TRANSITION, ATTR_XY_COLOR, @@ -37,16 +34,19 @@ from homeassistant.const import ( STATE_OFF, STATE_ON, STATE_UNAVAILABLE, + Platform, ) from homeassistant.core import HomeAssistant +from homeassistant.helpers import entity_registry as er from .conftest import ConfigEntryFactoryType, WebsocketDataType +from tests.common import snapshot_platform from tests.test_util.aiohttp import AiohttpClientMocker @pytest.mark.parametrize( - ("light_payload", "expected"), + "light_payload", [ ( # RGB light in color temp color mode { @@ -75,28 +75,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker "swversion": "5.127.1.26420", "type": "Extended color light", "uniqueid": "00:17:88:01:01:23:45:67-00", - }, - { - "entity_id": "light.hue_go", - "state": STATE_ON, - "attributes": { - ATTR_BRIGHTNESS: 254, - ATTR_COLOR_TEMP: 375, - ATTR_EFFECT_LIST: [EFFECT_COLORLOOP], - ATTR_SUPPORTED_COLOR_MODES: [ - ColorMode.COLOR_TEMP, - ColorMode.HS, - ColorMode.XY, - ], - ATTR_COLOR_MODE: ColorMode.COLOR_TEMP, - ATTR_MIN_MIREDS: 153, - ATTR_MAX_MIREDS: 500, - ATTR_SUPPORTED_FEATURES: LightEntityFeature.TRANSITION - | LightEntityFeature.FLASH - | LightEntityFeature.EFFECT, - DECONZ_GROUP: False, - }, - }, + } ), ( # RGB light in XY color mode { @@ -125,30 +104,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker "swversion": "1.65.9_hB3217DF4", "type": "Extended color light", "uniqueid": "00:17:88:01:01:23:45:67-01", - }, - { - "entity_id": "light.hue_ensis", - "state": STATE_ON, - "attributes": { - ATTR_MIN_MIREDS: 140, - ATTR_MAX_MIREDS: 650, - ATTR_EFFECT_LIST: [EFFECT_COLORLOOP], - ATTR_SUPPORTED_COLOR_MODES: [ - ColorMode.COLOR_TEMP, - ColorMode.HS, - ColorMode.XY, - ], - ATTR_COLOR_MODE: ColorMode.XY, - ATTR_BRIGHTNESS: 254, - ATTR_HS_COLOR: (29.691, 38.039), - ATTR_RGB_COLOR: (255, 206, 158), - ATTR_XY_COLOR: (0.427, 0.373), - DECONZ_GROUP: False, - ATTR_SUPPORTED_FEATURES: LightEntityFeature.TRANSITION - | LightEntityFeature.FLASH - | LightEntityFeature.EFFECT, - }, - }, + } ), ( # RGB light with only HS color mode { @@ -171,41 +127,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker "swversion": None, "type": "Color dimmable light", "uniqueid": "58:8e:81:ff:fe:db:7b:be-01", - }, - { - "entity_id": "light.lidl_xmas_light", - "state": STATE_ON, - "attributes": { - ATTR_EFFECT_LIST: [ - "carnival", - "collide", - "fading", - "fireworks", - "flag", - "glow", - "rainbow", - "snake", - "snow", - "sparkles", - "steady", - "strobe", - "twinkle", - "updown", - "vintage", - "waves", - ], - ATTR_SUPPORTED_COLOR_MODES: [ColorMode.HS], - ATTR_COLOR_MODE: ColorMode.HS, - ATTR_BRIGHTNESS: 25, - ATTR_HS_COLOR: (294.938, 55.294), - ATTR_RGB_COLOR: (243, 113, 255), - ATTR_XY_COLOR: (0.357, 0.188), - DECONZ_GROUP: False, - ATTR_SUPPORTED_FEATURES: LightEntityFeature.TRANSITION - | LightEntityFeature.FLASH - | LightEntityFeature.EFFECT, - }, - }, + } ), ( # Tunable white light in CT color mode { @@ -230,22 +152,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker "swversion": "1.46.13_r26312", "type": "Color temperature light", "uniqueid": "00:17:88:01:01:23:45:67-02", - }, - { - "entity_id": "light.hue_white_ambiance", - "state": STATE_ON, - "attributes": { - ATTR_MIN_MIREDS: 153, - ATTR_MAX_MIREDS: 454, - ATTR_SUPPORTED_COLOR_MODES: [ColorMode.COLOR_TEMP], - ATTR_COLOR_MODE: ColorMode.COLOR_TEMP, - ATTR_BRIGHTNESS: 254, - ATTR_COLOR_TEMP: 396, - DECONZ_GROUP: False, - ATTR_SUPPORTED_FEATURES: LightEntityFeature.TRANSITION - | LightEntityFeature.FLASH, - }, - }, + } ), ( # Dimmable light { @@ -260,19 +167,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker "swversion": "1.55.8_r28815", "type": "Dimmable light", "uniqueid": "00:17:88:01:01:23:45:67-03", - }, - { - "entity_id": "light.hue_filament", - "state": STATE_ON, - "attributes": { - ATTR_SUPPORTED_COLOR_MODES: [ColorMode.BRIGHTNESS], - ATTR_COLOR_MODE: ColorMode.BRIGHTNESS, - ATTR_BRIGHTNESS: 254, - DECONZ_GROUP: False, - ATTR_SUPPORTED_FEATURES: LightEntityFeature.TRANSITION - | LightEntityFeature.FLASH, - }, - }, + } ), ( # On/Off light { @@ -287,17 +182,7 @@ from tests.test_util.aiohttp import AiohttpClientMocker "swversion": "2.0", "type": "Simple light", "uniqueid": "00:15:8d:00:01:23:45:67-01", - }, - { - "entity_id": "light.simple_light", - "state": STATE_ON, - "attributes": { - ATTR_SUPPORTED_COLOR_MODES: [ColorMode.ONOFF], - ATTR_COLOR_MODE: ColorMode.ONOFF, - DECONZ_GROUP: False, - ATTR_SUPPORTED_FEATURES: 0, - }, - }, + } ), ( # Gradient light { @@ -396,42 +281,28 @@ from tests.test_util.aiohttp import AiohttpClientMocker "swversion": "1.104.2", "type": "Extended color light", "uniqueid": "00:17:88:01:0b:0c:0d:0e-0f", - }, - { - "entity_id": "light.gradient_light", - "state": STATE_ON, - "attributes": { - ATTR_SUPPORTED_COLOR_MODES: [ - ColorMode.COLOR_TEMP, - ColorMode.HS, - ColorMode.XY, - ], - ATTR_COLOR_MODE: ColorMode.XY, - }, - }, + } ), ], ) async def test_lights( hass: HomeAssistant, - config_entry_setup: ConfigEntry, - expected: dict[str, Any], + entity_registry: er.EntityRegistry, + config_entry_factory: ConfigEntryFactoryType, + snapshot: SnapshotAssertion, ) -> None: """Test that different light entities are created with expected values.""" - assert len(hass.states.async_all()) == 1 + with patch("homeassistant.components.deconz.PLATFORMS", [Platform.LIGHT]): + config_entry = await config_entry_factory() + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) - light = hass.states.get(expected["entity_id"]) - assert light.state == expected["state"] - for attribute, expected_value in expected["attributes"].items(): - assert light.attributes[attribute] == expected_value - - await hass.config_entries.async_unload(config_entry_setup.entry_id) + await hass.config_entries.async_unload(config_entry.entry_id) states = hass.states.async_all() for state in states: assert state.state == STATE_UNAVAILABLE - await hass.config_entries.async_remove(config_entry_setup.entry_id) + await hass.config_entries.async_remove(config_entry.entry_id) await hass.async_block_till_done() assert len(hass.states.async_all()) == 0 @@ -849,81 +720,20 @@ async def test_configuration_tool(hass: HomeAssistant) -> None: ], ) @pytest.mark.parametrize( - ("input", "expected"), + "input", [ - ( - { - "lights": ["1", "2", "3"], - }, - { - "entity_id": "light.group", - "state": ATTR_ON, - "attributes": { - ATTR_MIN_MIREDS: 153, - ATTR_MAX_MIREDS: 500, - ATTR_SUPPORTED_COLOR_MODES: [ColorMode.COLOR_TEMP, ColorMode.XY], - ATTR_COLOR_MODE: ColorMode.COLOR_TEMP, - ATTR_BRIGHTNESS: 255, - ATTR_EFFECT_LIST: [EFFECT_COLORLOOP], - "all_on": False, - DECONZ_GROUP: True, - ATTR_SUPPORTED_FEATURES: 44, - }, - }, - ), - ( - { - "lights": ["3", "1", "2"], - }, - { - "entity_id": "light.group", - "state": ATTR_ON, - "attributes": { - ATTR_MIN_MIREDS: 153, - ATTR_MAX_MIREDS: 500, - ATTR_SUPPORTED_COLOR_MODES: [ColorMode.COLOR_TEMP, ColorMode.XY], - ATTR_COLOR_MODE: ColorMode.COLOR_TEMP, - ATTR_BRIGHTNESS: 50, - ATTR_EFFECT_LIST: [EFFECT_COLORLOOP], - "all_on": False, - DECONZ_GROUP: True, - ATTR_SUPPORTED_FEATURES: LightEntityFeature.TRANSITION - | LightEntityFeature.FLASH - | LightEntityFeature.EFFECT, - }, - }, - ), - ( - { - "lights": ["2", "3", "1"], - }, - { - "entity_id": "light.group", - "state": ATTR_ON, - "attributes": { - ATTR_MIN_MIREDS: 153, - ATTR_MAX_MIREDS: 500, - ATTR_SUPPORTED_COLOR_MODES: [ColorMode.COLOR_TEMP, ColorMode.XY], - ATTR_COLOR_MODE: ColorMode.XY, - ATTR_HS_COLOR: (52.0, 100.0), - ATTR_RGB_COLOR: (255, 221, 0), - ATTR_XY_COLOR: (0.5, 0.5), - "all_on": False, - DECONZ_GROUP: True, - ATTR_SUPPORTED_FEATURES: LightEntityFeature.TRANSITION - | LightEntityFeature.FLASH - | LightEntityFeature.EFFECT, - }, - }, - ), + ({"lights": ["1", "2", "3"]}), + ({"lights": ["3", "1", "2"]}), + ({"lights": ["2", "3", "1"]}), ], ) async def test_groups( hass: HomeAssistant, + entity_registry: er.EntityRegistry, config_entry_factory: Callable[[], ConfigEntry], group_payload: dict[str, Any], input: dict[str, list[str]], - expected: dict[str, Any], + snapshot: SnapshotAssertion, ) -> None: """Test that different group entities are created with expected values.""" group_payload |= { @@ -948,14 +758,10 @@ async def test_groups( "lights": input["lights"], }, } - config_entry = await config_entry_factory() - assert len(hass.states.async_all()) == 4 - - group = hass.states.get(expected["entity_id"]) - assert group.state == expected["state"] - for attribute, expected_value in expected["attributes"].items(): - assert group.attributes[attribute] == expected_value + with patch("homeassistant.components.deconz.PLATFORMS", [Platform.LIGHT]): + config_entry = await config_entry_factory() + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) await hass.config_entries.async_unload(config_entry.entry_id)