Migrate Velbus to have Entity name (#135520)
parent
e3f03c9da1
commit
959cea45b8
|
@ -24,6 +24,7 @@ from .const import DOMAIN
|
|||
class VelbusEntity(Entity):
|
||||
"""Representation of a Velbus entity."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
_attr_should_poll: bool = False
|
||||
|
||||
def __init__(self, channel: VelbusChannel) -> None:
|
||||
|
|
|
@ -19,7 +19,7 @@ rules:
|
|||
docs-removal-instructions: done
|
||||
entity-event-setup: done
|
||||
entity-unique-id: done
|
||||
has-entity-name: todo
|
||||
has-entity-name: done
|
||||
runtime-data: done
|
||||
test-before-configure: done
|
||||
test-before-setup: done
|
||||
|
|
|
@ -114,7 +114,7 @@ def mock_button() -> AsyncMock:
|
|||
channel.get_channel_number.return_value = 1
|
||||
channel.get_module_type_name.return_value = "VMB4RYLD"
|
||||
channel.get_module_type.return_value = 99
|
||||
channel.get_full_name.return_value = "Channel full name"
|
||||
channel.get_full_name.return_value = "Bedroom kid 1"
|
||||
channel.get_module_sw_version.return_value = "1.0.0"
|
||||
channel.get_module_serial.return_value = "a1b2c3d4e5f6"
|
||||
channel.is_sub_device.return_value = False
|
||||
|
@ -132,7 +132,7 @@ def mock_temperature() -> AsyncMock:
|
|||
channel.get_module_address.return_value = 88
|
||||
channel.get_channel_number.return_value = 3
|
||||
channel.get_module_type_name.return_value = "VMB4GPO"
|
||||
channel.get_full_name.return_value = "Channel full name"
|
||||
channel.get_full_name.return_value = "Living room"
|
||||
channel.get_module_sw_version.return_value = "3.0.0"
|
||||
channel.get_module_serial.return_value = "asdfghjk"
|
||||
channel.get_module_type.return_value = 1
|
||||
|
@ -160,7 +160,7 @@ def mock_relay() -> AsyncMock:
|
|||
channel.get_module_address.return_value = 88
|
||||
channel.get_channel_number.return_value = 55
|
||||
channel.get_module_type_name.return_value = "VMB4RYNO"
|
||||
channel.get_full_name.return_value = "Full relay name"
|
||||
channel.get_full_name.return_value = "Living room"
|
||||
channel.get_module_sw_version.return_value = "1.0.1"
|
||||
channel.get_module_serial.return_value = "qwerty123"
|
||||
channel.get_module_type.return_value = 2
|
||||
|
@ -179,7 +179,7 @@ def mock_select() -> AsyncMock:
|
|||
channel.get_channel_number.return_value = 33
|
||||
channel.get_module_type_name.return_value = "VMB4RYNO"
|
||||
channel.get_module_type.return_value = 3
|
||||
channel.get_full_name.return_value = "Full module name"
|
||||
channel.get_full_name.return_value = "Kitchen"
|
||||
channel.get_module_sw_version.return_value = "1.1.1"
|
||||
channel.get_module_serial.return_value = "qwerty1234567"
|
||||
channel.is_sub_device.return_value = False
|
||||
|
@ -198,7 +198,7 @@ def mock_buttoncounter() -> AsyncMock:
|
|||
channel.get_channel_number.return_value = 2
|
||||
channel.get_module_type_name.return_value = "VMB7IN"
|
||||
channel.get_module_type.return_value = 4
|
||||
channel.get_full_name.return_value = "Channel full name"
|
||||
channel.get_full_name.return_value = "Input"
|
||||
channel.get_module_sw_version.return_value = "1.0.0"
|
||||
channel.get_module_serial.return_value = "a1b2c3d4e5f6"
|
||||
channel.is_sub_device.return_value = True
|
||||
|
@ -221,7 +221,7 @@ def mock_sensornumber() -> AsyncMock:
|
|||
channel.get_channel_number.return_value = 3
|
||||
channel.get_module_type_name.return_value = "VMB7IN"
|
||||
channel.get_module_type.return_value = 8
|
||||
channel.get_full_name.return_value = "Channel full name"
|
||||
channel.get_full_name.return_value = "Input"
|
||||
channel.get_module_sw_version.return_value = "1.0.0"
|
||||
channel.get_module_serial.return_value = "a1b2c3d4e5f6"
|
||||
channel.is_sub_device.return_value = False
|
||||
|
@ -242,7 +242,7 @@ def mock_lightsensor() -> AsyncMock:
|
|||
channel.get_channel_number.return_value = 4
|
||||
channel.get_module_type_name.return_value = "VMB7IN"
|
||||
channel.get_module_type.return_value = 8
|
||||
channel.get_full_name.return_value = "Channel full name"
|
||||
channel.get_full_name.return_value = "Input"
|
||||
channel.get_module_sw_version.return_value = "1.0.0"
|
||||
channel.get_module_serial.return_value = "a1b2c3d4e5f6"
|
||||
channel.is_sub_device.return_value = False
|
||||
|
@ -282,7 +282,7 @@ def mock_cover() -> AsyncMock:
|
|||
channel.get_channel_number.return_value = 9
|
||||
channel.get_module_type_name.return_value = "VMB2BLE"
|
||||
channel.get_module_type.return_value = 10
|
||||
channel.get_full_name.return_value = "Full cover name"
|
||||
channel.get_full_name.return_value = "Basement"
|
||||
channel.get_module_sw_version.return_value = "1.0.1"
|
||||
channel.get_module_serial.return_value = "1234"
|
||||
channel.is_sub_device.return_value = True
|
||||
|
@ -305,7 +305,7 @@ def mock_cover_no_position() -> AsyncMock:
|
|||
channel.get_channel_number.return_value = 11
|
||||
channel.get_module_type_name.return_value = "VMB2BLE"
|
||||
channel.get_module_type.return_value = 10
|
||||
channel.get_full_name.return_value = "Full cover name no position"
|
||||
channel.get_full_name.return_value = "Basement"
|
||||
channel.get_module_sw_version.return_value = "1.0.1"
|
||||
channel.get_module_serial.return_value = "12345"
|
||||
channel.is_sub_device.return_value = True
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# serializer version: 1
|
||||
# name: test_entities[binary_sensor.buttonon-entry]
|
||||
# name: test_entities[binary_sensor.bedroom_kid_1_buttonon-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -11,8 +11,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.buttonon',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'binary_sensor.bedroom_kid_1_buttonon',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -32,13 +32,13 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[binary_sensor.buttonon-state]
|
||||
# name: test_entities[binary_sensor.bedroom_kid_1_buttonon-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'ButtonOn',
|
||||
'friendly_name': 'Bedroom kid 1 ButtonOn',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.buttonon',
|
||||
'entity_id': 'binary_sensor.bedroom_kid_1_buttonon',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# serializer version: 1
|
||||
# name: test_entities[button.buttonon-entry]
|
||||
# name: test_entities[button.bedroom_kid_1_buttonon-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -11,8 +11,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'button.buttonon',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'button.bedroom_kid_1_buttonon',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -32,13 +32,13 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[button.buttonon-state]
|
||||
# name: test_entities[button.bedroom_kid_1_buttonon-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'ButtonOn',
|
||||
'friendly_name': 'Bedroom kid 1 ButtonOn',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'button.buttonon',
|
||||
'entity_id': 'button.bedroom_kid_1_buttonon',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# serializer version: 1
|
||||
# name: test_entities[climate.temperature-entry]
|
||||
# name: test_entities[climate.living_room_temperature-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -24,8 +24,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'climate',
|
||||
'entity_category': None,
|
||||
'entity_id': 'climate.temperature',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'climate.living_room_temperature',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -45,11 +45,11 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[climate.temperature-state]
|
||||
# name: test_entities[climate.living_room_temperature-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'current_temperature': 20.0,
|
||||
'friendly_name': 'Temperature',
|
||||
'friendly_name': 'Living room Temperature',
|
||||
'hvac_modes': list([
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
<HVACMode.COOL: 'cool'>,
|
||||
|
@ -67,7 +67,7 @@
|
|||
'temperature': 21.0,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'climate.temperature',
|
||||
'entity_id': 'climate.living_room_temperature',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# serializer version: 1
|
||||
# name: test_entities[cover.covername-entry]
|
||||
# name: test_entities[cover.basement_covername-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -11,8 +11,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'cover',
|
||||
'entity_category': None,
|
||||
'entity_id': 'cover.covername',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'cover.basement_covername',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -32,22 +32,22 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[cover.covername-state]
|
||||
# name: test_entities[cover.basement_covername-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'current_position': 50,
|
||||
'friendly_name': 'CoverName',
|
||||
'friendly_name': 'Basement CoverName',
|
||||
'supported_features': <CoverEntityFeature: 15>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'cover.covername',
|
||||
'entity_id': 'cover.basement_covername',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'open',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[cover.covernamenopos-entry]
|
||||
# name: test_entities[cover.basement_covernamenopos-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -59,8 +59,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'cover',
|
||||
'entity_category': None,
|
||||
'entity_id': 'cover.covernamenopos',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'cover.basement_covernamenopos',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -80,15 +80,15 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[cover.covernamenopos-state]
|
||||
# name: test_entities[cover.basement_covernamenopos-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'assumed_state': True,
|
||||
'friendly_name': 'CoverNameNoPos',
|
||||
'friendly_name': 'Basement CoverNameNoPos',
|
||||
'supported_features': <CoverEntityFeature: 11>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'cover.covernamenopos',
|
||||
'entity_id': 'cover.basement_covernamenopos',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
'manufacturer': 'Velleman',
|
||||
'model': 'VMB4RYLD',
|
||||
'model_id': '99',
|
||||
'name': 'Channel full name',
|
||||
'name': 'Bedroom kid 1',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': 'a1b2c3d4e5f6',
|
||||
|
@ -53,7 +53,7 @@
|
|||
'manufacturer': 'Velleman',
|
||||
'model': 'VMB2BLE',
|
||||
'model_id': '10',
|
||||
'name': 'Full cover name',
|
||||
'name': 'Basement',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': '1234',
|
||||
|
@ -83,7 +83,7 @@
|
|||
'manufacturer': 'Velleman',
|
||||
'model': 'VMB2BLE',
|
||||
'model_id': '10',
|
||||
'name': 'Full cover name no position',
|
||||
'name': 'Basement',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': '12345',
|
||||
|
@ -143,7 +143,7 @@
|
|||
'manufacturer': 'Velleman',
|
||||
'model': 'VMB7IN',
|
||||
'model_id': '4',
|
||||
'name': 'Channel full name',
|
||||
'name': 'Input',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': 'a1b2c3d4e5f6',
|
||||
|
@ -173,7 +173,7 @@
|
|||
'manufacturer': 'Velleman',
|
||||
'model': 'VMB4GPO',
|
||||
'model_id': '1',
|
||||
'name': 'Channel full name',
|
||||
'name': 'Living room',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': 'asdfghjk',
|
||||
|
@ -203,7 +203,7 @@
|
|||
'manufacturer': 'Velleman',
|
||||
'model': 'VMB7IN',
|
||||
'model_id': '8',
|
||||
'name': 'Channel full name',
|
||||
'name': 'Input',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': 'a1b2c3d4e5f6',
|
||||
|
@ -233,7 +233,7 @@
|
|||
'manufacturer': 'Velleman',
|
||||
'model': 'VMB4RYNO',
|
||||
'model_id': '2',
|
||||
'name': 'Full relay name',
|
||||
'name': 'Living room',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': 'qwerty123',
|
||||
|
|
|
@ -1,61 +1,5 @@
|
|||
# serializer version: 1
|
||||
# name: test_entities[light.dimmer-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': None,
|
||||
'entity_id': 'light.dimmer',
|
||||
'has_entity_name': False,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Dimmer',
|
||||
'platform': 'velbus',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': <LightEntityFeature: 32>,
|
||||
'translation_key': None,
|
||||
'unique_id': 'a1b2c3d4e5f6g7-10',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[light.dimmer-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'brightness': None,
|
||||
'color_mode': None,
|
||||
'friendly_name': 'Dimmer',
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
]),
|
||||
'supported_features': <LightEntityFeature: 32>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.dimmer',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[light.led_buttonon-entry]
|
||||
# name: test_entities[light.bedroom_kid_1_led_buttonon-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -71,8 +15,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'light.led_buttonon',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'light.bedroom_kid_1_led_buttonon',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -92,18 +36,74 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[light.led_buttonon-state]
|
||||
# name: test_entities[light.bedroom_kid_1_led_buttonon-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'color_mode': None,
|
||||
'friendly_name': 'LED ButtonOn',
|
||||
'friendly_name': 'Bedroom kid 1 LED ButtonOn',
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.ONOFF: 'onoff'>,
|
||||
]),
|
||||
'supported_features': <LightEntityFeature: 8>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.led_buttonon',
|
||||
'entity_id': 'light.bedroom_kid_1_led_buttonon',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[light.dimmer_full_name_dimmer-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': None,
|
||||
'entity_id': 'light.dimmer_full_name_dimmer',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Dimmer',
|
||||
'platform': 'velbus',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': <LightEntityFeature: 32>,
|
||||
'translation_key': None,
|
||||
'unique_id': 'a1b2c3d4e5f6g7-10',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[light.dimmer_full_name_dimmer-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'brightness': None,
|
||||
'color_mode': None,
|
||||
'friendly_name': 'Dimmer full name Dimmer',
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
]),
|
||||
'supported_features': <LightEntityFeature: 32>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.dimmer_full_name_dimmer',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# serializer version: 1
|
||||
# name: test_entities[select.select-entry]
|
||||
# name: test_entities[select.kitchen_select-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -18,8 +18,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'select',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'select.select',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'select.kitchen_select',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -39,10 +39,10 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[select.select-state]
|
||||
# name: test_entities[select.kitchen_select-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'select',
|
||||
'friendly_name': 'Kitchen select',
|
||||
'options': list([
|
||||
'none',
|
||||
'summer',
|
||||
|
@ -51,7 +51,7 @@
|
|||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'select.select',
|
||||
'entity_id': 'select.kitchen_select',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# serializer version: 1
|
||||
# name: test_entities[sensor.buttoncounter-entry]
|
||||
# name: test_entities[sensor.input_buttoncounter-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -13,8 +13,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.buttoncounter',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'sensor.input_buttoncounter',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -34,23 +34,23 @@
|
|||
'unit_of_measurement': 'W',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.buttoncounter-state]
|
||||
# name: test_entities[sensor.input_buttoncounter-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'power',
|
||||
'friendly_name': 'ButtonCounter',
|
||||
'friendly_name': 'Input ButtonCounter',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': 'W',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.buttoncounter',
|
||||
'entity_id': 'sensor.input_buttoncounter',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '100.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.buttoncounter_counter-entry]
|
||||
# name: test_entities[sensor.input_buttoncounter_counter-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -64,8 +64,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.buttoncounter_counter',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'sensor.input_buttoncounter_counter',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -85,24 +85,24 @@
|
|||
'unit_of_measurement': 'kWh',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.buttoncounter_counter-state]
|
||||
# name: test_entities[sensor.input_buttoncounter_counter-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'energy',
|
||||
'friendly_name': 'ButtonCounter-counter',
|
||||
'friendly_name': 'Input ButtonCounter-counter',
|
||||
'icon': 'mdi:counter',
|
||||
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
'unit_of_measurement': 'kWh',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.buttoncounter_counter',
|
||||
'entity_id': 'sensor.input_buttoncounter_counter',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '100.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.lightsensor-entry]
|
||||
# name: test_entities[sensor.input_lightsensor-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -116,8 +116,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.lightsensor',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'sensor.input_lightsensor',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -137,22 +137,22 @@
|
|||
'unit_of_measurement': 'illuminance',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.lightsensor-state]
|
||||
# name: test_entities[sensor.input_lightsensor-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'LightSensor',
|
||||
'friendly_name': 'Input LightSensor',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': 'illuminance',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.lightsensor',
|
||||
'entity_id': 'sensor.input_lightsensor',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '250.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.sensornumber-entry]
|
||||
# name: test_entities[sensor.input_sensornumber-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -166,8 +166,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.sensornumber',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'sensor.input_sensornumber',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -187,22 +187,22 @@
|
|||
'unit_of_measurement': 'm',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.sensornumber-state]
|
||||
# name: test_entities[sensor.input_sensornumber-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'SensorNumber',
|
||||
'friendly_name': 'Input SensorNumber',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': 'm',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.sensornumber',
|
||||
'entity_id': 'sensor.input_sensornumber',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '10.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.temperature-entry]
|
||||
# name: test_entities[sensor.living_room_temperature-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -216,8 +216,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.temperature',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'sensor.living_room_temperature',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -237,16 +237,16 @@
|
|||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.temperature-state]
|
||||
# name: test_entities[sensor.living_room_temperature-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'temperature',
|
||||
'friendly_name': 'Temperature',
|
||||
'friendly_name': 'Living room Temperature',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.temperature',
|
||||
'entity_id': 'sensor.living_room_temperature',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# serializer version: 1
|
||||
# name: test_entities[switch.relayname-entry]
|
||||
# name: test_entities[switch.living_room_relayname-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -11,8 +11,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.relayname',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'switch.living_room_relayname',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -32,13 +32,13 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[switch.relayname-state]
|
||||
# name: test_entities[switch.living_room_relayname-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'RelayName',
|
||||
'friendly_name': 'Living room RelayName',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.relayname',
|
||||
'entity_id': 'switch.living_room_relayname',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
|
|
@ -38,6 +38,9 @@ async def test_button_press(
|
|||
"""Test button press."""
|
||||
await init_integration(hass, config_entry)
|
||||
await hass.services.async_call(
|
||||
BUTTON_DOMAIN, SERVICE_PRESS, {ATTR_ENTITY_ID: "button.buttonon"}, blocking=True
|
||||
BUTTON_DOMAIN,
|
||||
SERVICE_PRESS,
|
||||
{ATTR_ENTITY_ID: "button.bedroom_kid_1_buttonon"},
|
||||
blocking=True,
|
||||
)
|
||||
mock_button.press.assert_called_once_with()
|
||||
|
|
|
@ -51,7 +51,7 @@ async def test_set_target_temperature(
|
|||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{ATTR_ENTITY_ID: "climate.temperature", ATTR_TEMPERATURE: 29},
|
||||
{ATTR_ENTITY_ID: "climate.living_room_temperature", ATTR_TEMPERATURE: 29},
|
||||
blocking=True,
|
||||
)
|
||||
mock_temperature.set_temp.assert_called_once_with(29)
|
||||
|
@ -78,7 +78,7 @@ async def test_set_preset_mode(
|
|||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_PRESET_MODE,
|
||||
{ATTR_ENTITY_ID: "climate.temperature", ATTR_PRESET_MODE: set_mode},
|
||||
{ATTR_ENTITY_ID: "climate.living_room_temperature", ATTR_PRESET_MODE: set_mode},
|
||||
blocking=True,
|
||||
)
|
||||
mock_temperature.set_preset.assert_called_once_with(expected_mode)
|
||||
|
@ -102,7 +102,7 @@ async def test_set_hvac_mode(
|
|||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{ATTR_ENTITY_ID: "climate.temperature", ATTR_HVAC_MODE: set_mode},
|
||||
{ATTR_ENTITY_ID: "climate.living_room_temperature", ATTR_HVAC_MODE: set_mode},
|
||||
blocking=True,
|
||||
)
|
||||
mock_temperature.set_mode.assert_called_once_with(set_mode)
|
||||
|
@ -119,7 +119,7 @@ async def test_set_hvac_mode_invalid(
|
|||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{ATTR_ENTITY_ID: "climate.temperature", ATTR_HVAC_MODE: "auto"},
|
||||
{ATTR_ENTITY_ID: "climate.living_room_temperature", ATTR_HVAC_MODE: "auto"},
|
||||
blocking=True,
|
||||
)
|
||||
mock_temperature.set_mode.assert_not_called()
|
||||
|
|
|
@ -38,8 +38,8 @@ async def test_entities(
|
|||
@pytest.mark.parametrize(
|
||||
("entity_id", "entity_num"),
|
||||
[
|
||||
("cover.covername", 0),
|
||||
("cover.covernamenopos", 1),
|
||||
("cover.basement_covername", 0),
|
||||
("cover.basement_covernamenopos", 1),
|
||||
],
|
||||
)
|
||||
async def test_actions(
|
||||
|
@ -84,7 +84,7 @@ async def test_position(
|
|||
await hass.services.async_call(
|
||||
COVER_DOMAIN,
|
||||
SERVICE_SET_COVER_POSITION,
|
||||
{ATTR_ENTITY_ID: "cover.covername", ATTR_POSITION: 25},
|
||||
{ATTR_ENTITY_ID: "cover.basement_covername", ATTR_POSITION: 25},
|
||||
blocking=True,
|
||||
)
|
||||
mock_cover.set_position.assert_called_once_with(75)
|
||||
|
|
|
@ -132,7 +132,7 @@ async def test_api_call(
|
|||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: "switch.relayname"},
|
||||
{ATTR_ENTITY_ID: "switch.living_room_relayname"},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ async def test_dimmer_actions(
|
|||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
SERVICE_TURN_OFF,
|
||||
{ATTR_ENTITY_ID: "light.dimmer"},
|
||||
{ATTR_ENTITY_ID: "light.dimmer_full_name_dimmer"},
|
||||
blocking=True,
|
||||
)
|
||||
mock_dimmer.set_dimmer_state.assert_called_once_with(0, 0)
|
||||
|
@ -60,7 +60,7 @@ async def test_dimmer_actions(
|
|||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: "light.dimmer", ATTR_TRANSITION: 1},
|
||||
{ATTR_ENTITY_ID: "light.dimmer_full_name_dimmer", ATTR_TRANSITION: 1},
|
||||
blocking=True,
|
||||
)
|
||||
mock_dimmer.restore_dimmer_state.assert_called_once_with(1)
|
||||
|
@ -68,7 +68,11 @@ async def test_dimmer_actions(
|
|||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: "light.dimmer", ATTR_BRIGHTNESS: 0, ATTR_TRANSITION: 1},
|
||||
{
|
||||
ATTR_ENTITY_ID: "light.dimmer_full_name_dimmer",
|
||||
ATTR_BRIGHTNESS: 0,
|
||||
ATTR_TRANSITION: 1,
|
||||
},
|
||||
blocking=True,
|
||||
)
|
||||
mock_dimmer.set_dimmer_state.assert_called_with(0, 1)
|
||||
|
@ -77,7 +81,7 @@ async def test_dimmer_actions(
|
|||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: "light.dimmer", ATTR_BRIGHTNESS: 33},
|
||||
{ATTR_ENTITY_ID: "light.dimmer_full_name_dimmer", ATTR_BRIGHTNESS: 33},
|
||||
blocking=True,
|
||||
)
|
||||
mock_dimmer.set_dimmer_state.assert_called_with(12, 0)
|
||||
|
@ -96,7 +100,7 @@ async def test_led_actions(
|
|||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
SERVICE_TURN_OFF,
|
||||
{ATTR_ENTITY_ID: "light.led_buttonon"},
|
||||
{ATTR_ENTITY_ID: "light.bedroom_kid_1_led_buttonon"},
|
||||
blocking=True,
|
||||
)
|
||||
mock_button.set_led_state.assert_called_once_with("off")
|
||||
|
@ -104,7 +108,7 @@ async def test_led_actions(
|
|||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: "light.led_buttonon"},
|
||||
{ATTR_ENTITY_ID: "light.bedroom_kid_1_led_buttonon"},
|
||||
blocking=True,
|
||||
)
|
||||
mock_button.set_led_state.assert_called_with("on")
|
||||
|
@ -113,7 +117,7 @@ async def test_led_actions(
|
|||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: "light.led_buttonon", ATTR_FLASH: FLASH_LONG},
|
||||
{ATTR_ENTITY_ID: "light.bedroom_kid_1_led_buttonon", ATTR_FLASH: FLASH_LONG},
|
||||
blocking=True,
|
||||
)
|
||||
mock_button.set_led_state.assert_called_with("slow")
|
||||
|
@ -122,7 +126,7 @@ async def test_led_actions(
|
|||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: "light.led_buttonon", ATTR_FLASH: FLASH_SHORT},
|
||||
{ATTR_ENTITY_ID: "light.bedroom_kid_1_led_buttonon", ATTR_FLASH: FLASH_SHORT},
|
||||
blocking=True,
|
||||
)
|
||||
mock_button.set_led_state.assert_called_with("fast")
|
||||
|
@ -131,7 +135,7 @@ async def test_led_actions(
|
|||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: "light.led_buttonon", ATTR_FLASH: FLASH_SHORT},
|
||||
{ATTR_ENTITY_ID: "light.bedroom_kid_1_led_buttonon", ATTR_FLASH: FLASH_SHORT},
|
||||
blocking=True,
|
||||
)
|
||||
mock_button.set_led_state.assert_called_with("fast")
|
||||
|
|
|
@ -46,7 +46,7 @@ async def test_select_program(
|
|||
await hass.services.async_call(
|
||||
SELECT_DOMAIN,
|
||||
SERVICE_SELECT_OPTION,
|
||||
{ATTR_ENTITY_ID: "select.select", ATTR_OPTION: set_program},
|
||||
{ATTR_ENTITY_ID: "select.kitchen_select", ATTR_OPTION: set_program},
|
||||
blocking=True,
|
||||
)
|
||||
mock_select.set_selected_program.assert_called_once_with(set_program)
|
||||
|
|
|
@ -43,7 +43,7 @@ async def test_switch_on_off(
|
|||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN,
|
||||
SERVICE_TURN_OFF,
|
||||
{ATTR_ENTITY_ID: "switch.relayname"},
|
||||
{ATTR_ENTITY_ID: "switch.living_room_relayname"},
|
||||
blocking=True,
|
||||
)
|
||||
mock_relay.turn_off.assert_called_once_with()
|
||||
|
@ -51,7 +51,7 @@ async def test_switch_on_off(
|
|||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: "switch.relayname"},
|
||||
{ATTR_ENTITY_ID: "switch.living_room_relayname"},
|
||||
blocking=True,
|
||||
)
|
||||
mock_relay.turn_on.assert_called_once_with()
|
||||
|
|
Loading…
Reference in New Issue