mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 01:11:51 -04:00
Use snapshot_platform in abode (#181732)
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# serializer version: 1
|
||||
# name: test_all_entities[alarm_control_panel.abode_alarm-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'alarm_control_panel',
|
||||
'entity_category': None,
|
||||
'entity_id': 'alarm_control_panel.abode_alarm',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': <AlarmControlPanelEntityFeature: 3>,
|
||||
'translation_key': None,
|
||||
'unique_id': '001122334455',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[alarm_control_panel.abode_alarm-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_backup': False,
|
||||
'cellular_backup': False,
|
||||
<AlarmControlPanelEntityStateAttribute.CHANGED_BY: 'changed_by'>: None,
|
||||
<AlarmControlPanelEntityStateAttribute.CODE_ARM_REQUIRED: 'code_arm_required'>: False,
|
||||
<AlarmControlPanelEntityStateAttribute.CODE_FORMAT: 'code_format'>: None,
|
||||
'device_id': 'area_1',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Abode Alarm',
|
||||
<EntityStateAttribute.SUPPORTED_FEATURES: 'supported_features'>: <AlarmControlPanelEntityFeature: 3>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'alarm_control_panel.abode_alarm',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'disarmed',
|
||||
})
|
||||
# ---
|
||||
@@ -0,0 +1,169 @@
|
||||
# serializer version: 1
|
||||
# name: test_all_entities[binary_sensor.front_door-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.front_door',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.WINDOW: 'window'>,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '2834013428b6035fba7d4054aa7b25a3',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[binary_sensor.front_door-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'window',
|
||||
'device_id': 'RF:01430030',
|
||||
'device_type': 'Door Contact',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Front Door',
|
||||
'no_response': False,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.front_door',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[binary_sensor.hallway_motion-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.hallway_motion',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.MOTION: 'motion'>,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'ba2c7e8d4430da8d34c31425a2823fe0',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[binary_sensor.hallway_motion-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'motion',
|
||||
'device_id': 'RF:01c34a30',
|
||||
'device_type': 'Occupancy',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Hallway Motion',
|
||||
'no_response': False,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.hallway_motion',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[binary_sensor.living_room_motion-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.living_room_motion',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.MOTION: 'motion'>,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '2f1bc34ceadac032af4fc9189ef821a8',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[binary_sensor.living_room_motion-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'motion',
|
||||
'device_id': 'SR:PIR',
|
||||
'device_type': 'Motion Sensor',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Living Room Motion',
|
||||
'no_response': False,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.living_room_motion',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
@@ -0,0 +1,59 @@
|
||||
# serializer version: 1
|
||||
# name: test_all_entities[camera.test_cam-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'camera',
|
||||
'entity_category': None,
|
||||
'entity_id': 'camera.test_cam',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'd0a3a1c316891ceb00c20118aae2a133',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[camera.test_cam-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<CameraEntityStateAttribute.ACCESS_TOKEN: 'access_token'>: '1',
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
'device_id': 'XF:b0c5ba27592a',
|
||||
'device_type': 'IP Cam',
|
||||
<EntityStateAttribute.ENTITY_PICTURE: 'entity_picture'>: '/api/camera_proxy/camera.test_cam?token=1',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Test Cam',
|
||||
'no_response': False,
|
||||
<EntityStateAttribute.SUPPORTED_FEATURES: 'supported_features'>: <CameraEntityFeature: 0>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'camera.test_cam',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'idle',
|
||||
})
|
||||
# ---
|
||||
@@ -0,0 +1,58 @@
|
||||
# serializer version: 1
|
||||
# name: test_all_entities[cover.garage_door-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'cover',
|
||||
'entity_category': None,
|
||||
'entity_id': 'cover.garage_door',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': <CoverEntityFeature: 11>,
|
||||
'translation_key': None,
|
||||
'unique_id': '61cbz3b542d2o33ed2fz02721bda3324',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[cover.garage_door-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
'device_id': 'ZW:00000007',
|
||||
'device_type': 'Secure Barrier',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Garage Door',
|
||||
<CoverEntityStateAttribute.IS_CLOSED: 'is_closed'>: True,
|
||||
'no_response': False,
|
||||
<EntityStateAttribute.SUPPORTED_FEATURES: 'supported_features'>: <CoverEntityFeature: 11>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'cover.garage_door',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'closed',
|
||||
})
|
||||
# ---
|
||||
@@ -0,0 +1,215 @@
|
||||
# serializer version: 1
|
||||
# name: test_all_entities[light.living_room_lamp-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<LightEntityCapabilityAttribute.MAX_COLOR_TEMP_KELVIN: 'max_color_temp_kelvin'>: 6535,
|
||||
<LightEntityCapabilityAttribute.MIN_COLOR_TEMP_KELVIN: 'min_color_temp_kelvin'>: 2000,
|
||||
<LightEntityCapabilityAttribute.SUPPORTED_COLOR_MODES: 'supported_color_modes'>: list([
|
||||
<ColorMode.COLOR_TEMP: 'color_temp'>,
|
||||
<ColorMode.HS: 'hs'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': None,
|
||||
'entity_id': 'light.living_room_lamp',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '741385f4388b2637df4c6b398fe50581',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[light.living_room_lamp-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
<LightEntityStateAttribute.BRIGHTNESS: 'brightness'>: 204,
|
||||
<LightEntityStateAttribute.COLOR_MODE: 'color_mode'>: <ColorMode.HS: 'hs'>,
|
||||
<LightEntityStateAttribute.COLOR_TEMP_KELVIN: 'color_temp_kelvin'>: None,
|
||||
'device_id': 'ZB:db5b1a',
|
||||
'device_type': 'RGB Dimmer',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Living Room Lamp',
|
||||
<LightEntityStateAttribute.HS_COLOR: 'hs_color'>: tuple(
|
||||
225,
|
||||
100,
|
||||
),
|
||||
<LightEntityCapabilityAttribute.MAX_COLOR_TEMP_KELVIN: 'max_color_temp_kelvin'>: 6535,
|
||||
<LightEntityCapabilityAttribute.MIN_COLOR_TEMP_KELVIN: 'min_color_temp_kelvin'>: 2000,
|
||||
'no_response': False,
|
||||
<LightEntityStateAttribute.RGB_COLOR: 'rgb_color'>: tuple(
|
||||
0,
|
||||
64,
|
||||
255,
|
||||
),
|
||||
<LightEntityCapabilityAttribute.SUPPORTED_COLOR_MODES: 'supported_color_modes'>: list([
|
||||
<ColorMode.COLOR_TEMP: 'color_temp'>,
|
||||
<ColorMode.HS: 'hs'>,
|
||||
]),
|
||||
<EntityStateAttribute.SUPPORTED_FEATURES: 'supported_features'>: <LightEntityFeature: 0>,
|
||||
<LightEntityStateAttribute.XY_COLOR: 'xy_color'>: tuple(
|
||||
0.137,
|
||||
0.066,
|
||||
),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.living_room_lamp',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[light.test_dimmer_only_device-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<LightEntityCapabilityAttribute.SUPPORTED_COLOR_MODES: 'supported_color_modes'>: list([
|
||||
<ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': None,
|
||||
'entity_id': 'light.test_dimmer_only_device',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '641385f4388b2637df4c6b398fe50581',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[light.test_dimmer_only_device-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
<LightEntityStateAttribute.BRIGHTNESS: 'brightness'>: 255,
|
||||
<LightEntityStateAttribute.COLOR_MODE: 'color_mode'>: <ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
'device_id': 'ZB:db5b1b',
|
||||
'device_type': 'Dimmer',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Test Dimmer Only Device',
|
||||
'no_response': False,
|
||||
<LightEntityCapabilityAttribute.SUPPORTED_COLOR_MODES: 'supported_color_modes'>: list([
|
||||
<ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
]),
|
||||
<EntityStateAttribute.SUPPORTED_FEATURES: 'supported_features'>: <LightEntityFeature: 0>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.test_dimmer_only_device',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[light.test_non_dimmer_device-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<LightEntityCapabilityAttribute.SUPPORTED_COLOR_MODES: 'supported_color_modes'>: list([
|
||||
<ColorMode.ONOFF: 'onoff'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': None,
|
||||
'entity_id': 'light.test_non_dimmer_device',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '641385f4388b2637df4c6b398fe50583',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[light.test_non_dimmer_device-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
<LightEntityStateAttribute.COLOR_MODE: 'color_mode'>: <ColorMode.ONOFF: 'onoff'>,
|
||||
'device_id': 'ZB:db5b1c',
|
||||
'device_type': 'Light',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Test Non-dimmer Device',
|
||||
'no_response': False,
|
||||
<LightEntityCapabilityAttribute.SUPPORTED_COLOR_MODES: 'supported_color_modes'>: list([
|
||||
<ColorMode.ONOFF: 'onoff'>,
|
||||
]),
|
||||
<EntityStateAttribute.SUPPORTED_FEATURES: 'supported_features'>: <LightEntityFeature: 0>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.test_non_dimmer_device',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
@@ -0,0 +1,57 @@
|
||||
# serializer version: 1
|
||||
# name: test_all_entities[lock.test_lock-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'lock',
|
||||
'entity_category': None,
|
||||
'entity_id': 'lock.test_lock',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '51cab3b545d2o34ed7fz02731bda5324',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[lock.test_lock-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
'device_id': 'ZW:00000004',
|
||||
'device_type': 'Door Lock',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Test Lock',
|
||||
'no_response': False,
|
||||
<EntityStateAttribute.SUPPORTED_FEATURES: 'supported_features'>: <LockEntityFeature: 0>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'lock.test_lock',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'locked',
|
||||
})
|
||||
# ---
|
||||
@@ -0,0 +1,184 @@
|
||||
# serializer version: 1
|
||||
# name: test_all_entities[sensor.environment_sensor_humidity-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.environment_sensor_humidity',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Humidity',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.HUMIDITY: 'humidity'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Humidity',
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '13545b21f4bdcd33d9abd461f8443e65-humidity',
|
||||
'unit_of_measurement': '%',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.environment_sensor_humidity-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'humidity',
|
||||
'device_id': 'RF:02148e70',
|
||||
'device_type': 'LM',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Environment Sensor Humidity',
|
||||
'no_response': False,
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: '%',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.environment_sensor_humidity',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '32.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.environment_sensor_illuminance-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.environment_sensor_illuminance',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Illuminance',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ILLUMINANCE: 'illuminance'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Illuminance',
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '13545b21f4bdcd33d9abd461f8443e65-lux',
|
||||
'unit_of_measurement': 'lx',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.environment_sensor_illuminance-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'illuminance',
|
||||
'device_id': 'RF:02148e70',
|
||||
'device_type': 'LM',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Environment Sensor Illuminance',
|
||||
'no_response': False,
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: 'lx',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.environment_sensor_illuminance',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '1.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.environment_sensor_temperature-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.environment_sensor_temperature',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Temperature',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 1,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TEMPERATURE: 'temperature'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Temperature',
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '13545b21f4bdcd33d9abd461f8443e65-temperature',
|
||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.environment_sensor_temperature-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'temperature',
|
||||
'device_id': 'RF:02148e70',
|
||||
'device_type': 'LM',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Environment Sensor Temperature',
|
||||
'no_response': False,
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.environment_sensor_temperature',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '19.4444444444444',
|
||||
})
|
||||
# ---
|
||||
@@ -0,0 +1,108 @@
|
||||
# serializer version: 1
|
||||
# name: test_all_entities[switch.test_automation-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.test_automation',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Test Automation',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Test Automation',
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'automation',
|
||||
'unique_id': '47fae27488f74f55b964a81a066c3a01',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[switch.test_automation-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Test Automation',
|
||||
'type': 'CUE automation',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.test_automation',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[switch.test_switch-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.test_switch',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'abode',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '0012a4d3614cb7e2b8c9abea31d2fb2a',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[switch.test_switch-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by goabode.com',
|
||||
'battery_low': False,
|
||||
'device_id': 'ZW:0000000b',
|
||||
'device_type': 'Power Switch Sensor',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Test Switch',
|
||||
'no_response': False,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.test_switch',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
@@ -2,15 +2,14 @@
|
||||
|
||||
from unittest.mock import PropertyMock, patch
|
||||
|
||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
DOMAIN as ALARM_DOMAIN,
|
||||
AlarmControlPanelState,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_FRIENDLY_NAME,
|
||||
ATTR_SUPPORTED_FEATURES,
|
||||
SERVICE_ALARM_ARM_AWAY,
|
||||
SERVICE_ALARM_ARM_HOME,
|
||||
SERVICE_ALARM_DISARM,
|
||||
@@ -20,31 +19,20 @@ from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.common import snapshot_platform
|
||||
|
||||
DEVICE_ID = "alarm_control_panel.abode_alarm"
|
||||
|
||||
|
||||
async def test_entity_registry(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
async def test_all_entities(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Tests that the devices are registered in the entity registry."""
|
||||
await setup_platform(hass, ALARM_DOMAIN)
|
||||
"""Test all entities."""
|
||||
config_entry = await setup_platform(hass, ALARM_DOMAIN)
|
||||
|
||||
entry = entity_registry.async_get(DEVICE_ID)
|
||||
# Abode alarm device unique_id is the MAC address
|
||||
assert entry.unique_id == "001122334455"
|
||||
|
||||
|
||||
async def test_attributes(hass: HomeAssistant) -> None:
|
||||
"""Test the alarm control panel attributes are correct."""
|
||||
await setup_platform(hass, ALARM_DOMAIN)
|
||||
|
||||
state = hass.states.get(DEVICE_ID)
|
||||
assert state.state == AlarmControlPanelState.DISARMED
|
||||
assert state.attributes.get(ATTR_DEVICE_ID) == "area_1"
|
||||
assert not state.attributes.get("battery_backup")
|
||||
assert not state.attributes.get("cellular_backup")
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Abode Alarm"
|
||||
assert state.attributes.get(ATTR_SUPPORTED_FEATURES) == 3
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
|
||||
|
||||
async def test_set_alarm_away(hass: HomeAssistant) -> None:
|
||||
|
||||
@@ -1,43 +1,22 @@
|
||||
"""Tests for the Abode binary sensor device."""
|
||||
|
||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||
from homeassistant.components.abode.const import ATTRIBUTION
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DOMAIN as BINARY_SENSOR_DOMAIN,
|
||||
BinarySensorDeviceClass,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
ATTR_DEVICE_CLASS,
|
||||
ATTR_FRIENDLY_NAME,
|
||||
STATE_OFF,
|
||||
)
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.common import snapshot_platform
|
||||
|
||||
async def test_entity_registry(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
|
||||
async def test_all_entities(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Tests that the devices are registered in the entity registry."""
|
||||
await setup_platform(hass, BINARY_SENSOR_DOMAIN)
|
||||
"""Test all entities."""
|
||||
config_entry = await setup_platform(hass, BINARY_SENSOR_DOMAIN)
|
||||
|
||||
entry = entity_registry.async_get("binary_sensor.front_door")
|
||||
assert entry.unique_id == "2834013428b6035fba7d4054aa7b25a3"
|
||||
|
||||
|
||||
async def test_attributes(hass: HomeAssistant) -> None:
|
||||
"""Test the binary sensor attributes are correct."""
|
||||
await setup_platform(hass, BINARY_SENSOR_DOMAIN)
|
||||
|
||||
state = hass.states.get("binary_sensor.front_door")
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION
|
||||
assert state.attributes.get(ATTR_DEVICE_ID) == "RF:01430030"
|
||||
assert not state.attributes.get("battery_low")
|
||||
assert not state.attributes.get("no_response")
|
||||
assert state.attributes.get("device_type") == "Door Contact"
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Front Door"
|
||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == BinarySensorDeviceClass.WINDOW
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
|
||||
@@ -2,31 +2,39 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.abode.const import DOMAIN
|
||||
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN, CameraState
|
||||
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.common import snapshot_platform
|
||||
|
||||
async def test_entity_registry(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_getrandbits():
|
||||
"""Mock camera access token which normally is randomized."""
|
||||
with patch(
|
||||
"homeassistant.components.camera.SystemRandom.getrandbits",
|
||||
return_value=1,
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
async def test_all_entities(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Tests that the devices are registered in the entity registry."""
|
||||
await setup_platform(hass, CAMERA_DOMAIN)
|
||||
"""Test all entities."""
|
||||
config_entry = await setup_platform(hass, CAMERA_DOMAIN)
|
||||
|
||||
entry = entity_registry.async_get("camera.test_cam")
|
||||
assert entry.unique_id == "d0a3a1c316891ceb00c20118aae2a133"
|
||||
|
||||
|
||||
async def test_attributes(hass: HomeAssistant) -> None:
|
||||
"""Test the camera attributes are correct."""
|
||||
await setup_platform(hass, CAMERA_DOMAIN)
|
||||
|
||||
state = hass.states.get("camera.test_cam")
|
||||
assert state.state == CameraState.IDLE
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
|
||||
|
||||
async def test_capture_image(hass: HomeAssistant) -> None:
|
||||
|
||||
@@ -2,43 +2,29 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||
from homeassistant.components.cover import DOMAIN as COVER_DOMAIN, CoverState
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_FRIENDLY_NAME,
|
||||
SERVICE_CLOSE_COVER,
|
||||
SERVICE_OPEN_COVER,
|
||||
)
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.cover import DOMAIN as COVER_DOMAIN
|
||||
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_CLOSE_COVER, SERVICE_OPEN_COVER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.common import snapshot_platform
|
||||
|
||||
DEVICE_ID = "cover.garage_door"
|
||||
|
||||
|
||||
async def test_entity_registry(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
async def test_all_entities(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Tests that the devices are registered in the entity registry."""
|
||||
await setup_platform(hass, COVER_DOMAIN)
|
||||
"""Test all entities."""
|
||||
config_entry = await setup_platform(hass, COVER_DOMAIN)
|
||||
|
||||
entry = entity_registry.async_get(DEVICE_ID)
|
||||
assert entry.unique_id == "61cbz3b542d2o33ed2fz02721bda3324"
|
||||
|
||||
|
||||
async def test_attributes(hass: HomeAssistant) -> None:
|
||||
"""Test the cover attributes are correct."""
|
||||
await setup_platform(hass, COVER_DOMAIN)
|
||||
|
||||
state = hass.states.get(DEVICE_ID)
|
||||
assert state.state == CoverState.CLOSED
|
||||
assert state.attributes.get(ATTR_DEVICE_ID) == "ZW:00000007"
|
||||
assert not state.attributes.get("battery_low")
|
||||
assert not state.attributes.get("no_response")
|
||||
assert state.attributes.get("device_type") == "Secure Barrier"
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Garage Door"
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
|
||||
|
||||
async def test_open(hass: HomeAssistant) -> None:
|
||||
|
||||
@@ -2,62 +2,29 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_COLOR_MODE,
|
||||
ATTR_COLOR_TEMP_KELVIN,
|
||||
ATTR_RGB_COLOR,
|
||||
ATTR_SUPPORTED_COLOR_MODES,
|
||||
DOMAIN as LIGHT_DOMAIN,
|
||||
ColorMode,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_FRIENDLY_NAME,
|
||||
ATTR_SUPPORTED_FEATURES,
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
STATE_ON,
|
||||
)
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
|
||||
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.common import snapshot_platform
|
||||
|
||||
DEVICE_ID = "light.living_room_lamp"
|
||||
|
||||
|
||||
async def test_entity_registry(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
async def test_all_entities(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Tests that the devices are registered in the entity registry."""
|
||||
await setup_platform(hass, LIGHT_DOMAIN)
|
||||
"""Test all entities."""
|
||||
config_entry = await setup_platform(hass, LIGHT_DOMAIN)
|
||||
|
||||
entry = entity_registry.async_get(DEVICE_ID)
|
||||
assert entry.unique_id == "741385f4388b2637df4c6b398fe50581"
|
||||
|
||||
|
||||
async def test_attributes(hass: HomeAssistant) -> None:
|
||||
"""Test the light attributes are correct."""
|
||||
await setup_platform(hass, LIGHT_DOMAIN)
|
||||
|
||||
state = hass.states.get(DEVICE_ID)
|
||||
assert state.state == STATE_ON
|
||||
assert state.attributes.get(ATTR_BRIGHTNESS) == 204
|
||||
assert state.attributes.get(ATTR_RGB_COLOR) == (0, 64, 255)
|
||||
assert state.attributes.get(ATTR_COLOR_TEMP_KELVIN) is None
|
||||
assert state.attributes.get(ATTR_DEVICE_ID) == "ZB:db5b1a"
|
||||
assert not state.attributes.get("battery_low")
|
||||
assert not state.attributes.get("no_response")
|
||||
assert state.attributes.get("device_type") == "RGB Dimmer"
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Living Room Lamp"
|
||||
assert state.attributes.get(ATTR_SUPPORTED_FEATURES) == 0
|
||||
assert state.attributes.get(ATTR_COLOR_MODE) == ColorMode.HS
|
||||
assert state.attributes.get(ATTR_SUPPORTED_COLOR_MODES) == [
|
||||
ColorMode.COLOR_TEMP,
|
||||
ColorMode.HS,
|
||||
]
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
|
||||
|
||||
async def test_switch_off(hass: HomeAssistant) -> None:
|
||||
|
||||
@@ -5,46 +5,29 @@ from unittest.mock import patch
|
||||
|
||||
from jaraco.abode.helpers import urls as URL
|
||||
from requests_mock import Mocker
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||
from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN, LockState
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_FRIENDLY_NAME,
|
||||
SERVICE_LOCK,
|
||||
SERVICE_UNLOCK,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_LOCK, SERVICE_UNLOCK
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.common import async_load_json_array_fixture
|
||||
from tests.common import async_load_json_array_fixture, snapshot_platform
|
||||
|
||||
DEVICE_ID = "lock.test_lock"
|
||||
|
||||
|
||||
async def test_entity_registry(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
async def test_all_entities(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Tests that the devices are registered in the entity registry."""
|
||||
await setup_platform(hass, LOCK_DOMAIN)
|
||||
"""Test all entities."""
|
||||
config_entry = await setup_platform(hass, LOCK_DOMAIN)
|
||||
|
||||
entry = entity_registry.async_get(DEVICE_ID)
|
||||
assert entry.unique_id == "51cab3b545d2o34ed7fz02731bda5324"
|
||||
|
||||
|
||||
async def test_attributes(hass: HomeAssistant) -> None:
|
||||
"""Test the lock attributes are correct."""
|
||||
await setup_platform(hass, LOCK_DOMAIN)
|
||||
|
||||
state = hass.states.get(DEVICE_ID)
|
||||
assert state.state == LockState.LOCKED
|
||||
assert state.attributes.get(ATTR_DEVICE_ID) == "ZW:00000004"
|
||||
assert not state.attributes.get("battery_low")
|
||||
assert not state.attributes.get("no_response")
|
||||
assert state.attributes.get("device_type") == "Door Lock"
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Test Lock"
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
|
||||
|
||||
async def test_lock(hass: HomeAssistant) -> None:
|
||||
|
||||
@@ -1,59 +1,22 @@
|
||||
"""Tests for the Abode sensor device."""
|
||||
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.abode import ATTR_DEVICE_ID
|
||||
from homeassistant.components.sensor import (
|
||||
ATTR_STATE_CLASS,
|
||||
DOMAIN as SENSOR_DOMAIN,
|
||||
SensorDeviceClass,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_CLASS,
|
||||
ATTR_FRIENDLY_NAME,
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
PERCENTAGE,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.common import snapshot_platform
|
||||
|
||||
async def test_entity_registry(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
|
||||
async def test_all_entities(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Tests that the devices are registered in the entity registry."""
|
||||
await setup_platform(hass, SENSOR_DOMAIN)
|
||||
"""Test all entities."""
|
||||
config_entry = await setup_platform(hass, SENSOR_DOMAIN)
|
||||
|
||||
entry = entity_registry.async_get("sensor.environment_sensor_humidity")
|
||||
assert entry.unique_id == "13545b21f4bdcd33d9abd461f8443e65-humidity"
|
||||
|
||||
|
||||
async def test_attributes(hass: HomeAssistant) -> None:
|
||||
"""Test the sensor attributes are correct."""
|
||||
await setup_platform(hass, SENSOR_DOMAIN)
|
||||
|
||||
state = hass.states.get("sensor.environment_sensor_humidity")
|
||||
assert state.state == "32.0"
|
||||
assert state.attributes.get(ATTR_DEVICE_ID) == "RF:02148e70"
|
||||
assert not state.attributes.get("battery_low")
|
||||
assert not state.attributes.get("no_response")
|
||||
assert state.attributes.get("device_type") == "LM"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Environment Sensor Humidity"
|
||||
assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.HUMIDITY
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
|
||||
state = hass.states.get("sensor.environment_sensor_illuminance")
|
||||
assert state.state == "1.0"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "lx"
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
|
||||
state = hass.states.get("sensor.environment_sensor_temperature")
|
||||
# Abodepy device JSON reports 19.5, but Home Assistant shows 19.4
|
||||
assert float(state.state) == pytest.approx(19.44444)
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfTemperature.CELSIUS
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
|
||||
@@ -2,45 +2,31 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.abode.const import DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
from tests.common import snapshot_platform
|
||||
|
||||
AUTOMATION_ID = "switch.test_automation"
|
||||
AUTOMATION_UID = "47fae27488f74f55b964a81a066c3a01"
|
||||
DEVICE_ID = "switch.test_switch"
|
||||
DEVICE_UID = "0012a4d3614cb7e2b8c9abea31d2fb2a"
|
||||
|
||||
|
||||
async def test_entity_registry(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
async def test_all_entities(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Tests that the devices are registered in the entity registry."""
|
||||
await setup_platform(hass, SWITCH_DOMAIN)
|
||||
"""Test all entities."""
|
||||
config_entry = await setup_platform(hass, SWITCH_DOMAIN)
|
||||
|
||||
entry = entity_registry.async_get(AUTOMATION_ID)
|
||||
assert entry.unique_id == AUTOMATION_UID
|
||||
|
||||
entry = entity_registry.async_get(DEVICE_ID)
|
||||
assert entry.unique_id == DEVICE_UID
|
||||
|
||||
|
||||
async def test_attributes(hass: HomeAssistant) -> None:
|
||||
"""Test the switch attributes are correct."""
|
||||
await setup_platform(hass, SWITCH_DOMAIN)
|
||||
|
||||
state = hass.states.get(DEVICE_ID)
|
||||
assert state.state == STATE_OFF
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
|
||||
|
||||
async def test_switch_on(hass: HomeAssistant) -> None:
|
||||
@@ -69,15 +55,6 @@ async def test_switch_off(hass: HomeAssistant) -> None:
|
||||
mock_switch_off.assert_called_once()
|
||||
|
||||
|
||||
async def test_automation_attributes(hass: HomeAssistant) -> None:
|
||||
"""Test the automation attributes are correct."""
|
||||
await setup_platform(hass, SWITCH_DOMAIN)
|
||||
|
||||
state = hass.states.get(AUTOMATION_ID)
|
||||
# State is set based on "enabled" key in automation JSON.
|
||||
assert state.state == STATE_ON
|
||||
|
||||
|
||||
async def test_turn_automation_off(hass: HomeAssistant) -> None:
|
||||
"""Test the automation can be turned off."""
|
||||
with patch("jaraco.abode.automation.Automation.enable") as mock_trigger:
|
||||
|
||||
Reference in New Issue
Block a user