From 959cea45b8b9496469494c709b9ee8c371310454 Mon Sep 17 00:00:00 2001 From: Maikel Punie Date: Tue, 14 Jan 2025 11:30:10 +0100 Subject: [PATCH] Migrate Velbus to have Entity name (#135520) --- homeassistant/components/velbus/entity.py | 1 + .../components/velbus/quality_scale.yaml | 2 +- tests/components/velbus/conftest.py | 18 +-- .../velbus/snapshots/test_binary_sensor.ambr | 12 +- .../velbus/snapshots/test_button.ambr | 12 +- .../velbus/snapshots/test_climate.ambr | 12 +- .../velbus/snapshots/test_cover.ambr | 24 ++-- .../velbus/snapshots/test_init.ambr | 14 +- .../velbus/snapshots/test_light.ambr | 124 +++++++++--------- .../velbus/snapshots/test_select.ambr | 12 +- .../velbus/snapshots/test_sensor.ambr | 60 ++++----- .../velbus/snapshots/test_switch.ambr | 12 +- tests/components/velbus/test_button.py | 5 +- tests/components/velbus/test_climate.py | 8 +- tests/components/velbus/test_cover.py | 6 +- tests/components/velbus/test_init.py | 2 +- tests/components/velbus/test_light.py | 22 ++-- tests/components/velbus/test_select.py | 2 +- tests/components/velbus/test_switch.py | 4 +- 19 files changed, 180 insertions(+), 172 deletions(-) diff --git a/homeassistant/components/velbus/entity.py b/homeassistant/components/velbus/entity.py index 634d20dcfa6..07dac78b6f1 100644 --- a/homeassistant/components/velbus/entity.py +++ b/homeassistant/components/velbus/entity.py @@ -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: diff --git a/homeassistant/components/velbus/quality_scale.yaml b/homeassistant/components/velbus/quality_scale.yaml index 05e9c168b92..95d0cc0355f 100644 --- a/homeassistant/components/velbus/quality_scale.yaml +++ b/homeassistant/components/velbus/quality_scale.yaml @@ -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 diff --git a/tests/components/velbus/conftest.py b/tests/components/velbus/conftest.py index b9145cc256a..5094b35d0aa 100644 --- a/tests/components/velbus/conftest.py +++ b/tests/components/velbus/conftest.py @@ -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 diff --git a/tests/components/velbus/snapshots/test_binary_sensor.ambr b/tests/components/velbus/snapshots/test_binary_sensor.ambr index 998f2528d9c..58630b9f6c9 100644 --- a/tests/components/velbus/snapshots/test_binary_sensor.ambr +++ b/tests/components/velbus/snapshots/test_binary_sensor.ambr @@ -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': , @@ -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': , - 'entity_id': 'binary_sensor.buttonon', + 'entity_id': 'binary_sensor.bedroom_kid_1_buttonon', 'last_changed': , 'last_reported': , 'last_updated': , diff --git a/tests/components/velbus/snapshots/test_button.ambr b/tests/components/velbus/snapshots/test_button.ambr index afe79466a44..952af21b43c 100644 --- a/tests/components/velbus/snapshots/test_button.ambr +++ b/tests/components/velbus/snapshots/test_button.ambr @@ -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': , - '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': , @@ -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': , - 'entity_id': 'button.buttonon', + 'entity_id': 'button.bedroom_kid_1_buttonon', 'last_changed': , 'last_reported': , 'last_updated': , diff --git a/tests/components/velbus/snapshots/test_climate.ambr b/tests/components/velbus/snapshots/test_climate.ambr index 567e45d9299..b1933e51868 100644 --- a/tests/components/velbus/snapshots/test_climate.ambr +++ b/tests/components/velbus/snapshots/test_climate.ambr @@ -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': , @@ -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([ , , @@ -67,7 +67,7 @@ 'temperature': 21.0, }), 'context': , - 'entity_id': 'climate.temperature', + 'entity_id': 'climate.living_room_temperature', 'last_changed': , 'last_reported': , 'last_updated': , diff --git a/tests/components/velbus/snapshots/test_cover.ambr b/tests/components/velbus/snapshots/test_cover.ambr index 1ca867ec9a4..a9cbd4aae73 100644 --- a/tests/components/velbus/snapshots/test_cover.ambr +++ b/tests/components/velbus/snapshots/test_cover.ambr @@ -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': , @@ -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': , }), 'context': , - 'entity_id': 'cover.covername', + 'entity_id': 'cover.basement_covername', 'last_changed': , 'last_reported': , 'last_updated': , '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': , @@ -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': , }), 'context': , - 'entity_id': 'cover.covernamenopos', + 'entity_id': 'cover.basement_covernamenopos', 'last_changed': , 'last_reported': , 'last_updated': , diff --git a/tests/components/velbus/snapshots/test_init.ambr b/tests/components/velbus/snapshots/test_init.ambr index 850231a45d2..a55a00ef0f2 100644 --- a/tests/components/velbus/snapshots/test_init.ambr +++ b/tests/components/velbus/snapshots/test_init.ambr @@ -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': , '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': , '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': , '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': , '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': , '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': , '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': , 'serial_number': 'qwerty123', diff --git a/tests/components/velbus/snapshots/test_light.ambr b/tests/components/velbus/snapshots/test_light.ambr index ec18305984c..b7009a0c66a 100644 --- a/tests/components/velbus/snapshots/test_light.ambr +++ b/tests/components/velbus/snapshots/test_light.ambr @@ -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([ - , - ]), - }), - 'config_entry_id': , - 'device_class': None, - 'device_id': , - 'disabled_by': None, - 'domain': 'light', - 'entity_category': None, - 'entity_id': 'light.dimmer', - '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': 'Dimmer', - 'platform': 'velbus', - 'previous_unique_id': None, - 'supported_features': , - '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([ - , - ]), - 'supported_features': , - }), - 'context': , - 'entity_id': 'light.dimmer', - 'last_changed': , - 'last_reported': , - 'last_updated': , - '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': , - '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': , @@ -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([ , ]), 'supported_features': , }), 'context': , - 'entity_id': 'light.led_buttonon', + 'entity_id': 'light.bedroom_kid_1_led_buttonon', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_entities[light.dimmer_full_name_dimmer-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.dimmer_full_name_dimmer', + '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': 'Dimmer', + 'platform': 'velbus', + 'previous_unique_id': None, + 'supported_features': , + '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([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.dimmer_full_name_dimmer', 'last_changed': , 'last_reported': , 'last_updated': , diff --git a/tests/components/velbus/snapshots/test_select.ambr b/tests/components/velbus/snapshots/test_select.ambr index 5678c0ded5f..288eb10a3c3 100644 --- a/tests/components/velbus/snapshots/test_select.ambr +++ b/tests/components/velbus/snapshots/test_select.ambr @@ -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': , - 'entity_id': 'select.select', - 'has_entity_name': False, + 'entity_id': 'select.kitchen_select', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -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': , - 'entity_id': 'select.select', + 'entity_id': 'select.kitchen_select', 'last_changed': , 'last_reported': , 'last_updated': , diff --git a/tests/components/velbus/snapshots/test_sensor.ambr b/tests/components/velbus/snapshots/test_sensor.ambr index 132f4c7a059..6860ad73e2c 100644 --- a/tests/components/velbus/snapshots/test_sensor.ambr +++ b/tests/components/velbus/snapshots/test_sensor.ambr @@ -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': , @@ -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': , 'unit_of_measurement': 'W', }), 'context': , - 'entity_id': 'sensor.buttoncounter', + 'entity_id': 'sensor.input_buttoncounter', 'last_changed': , 'last_reported': , 'last_updated': , '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': , @@ -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': , 'unit_of_measurement': 'kWh', }), 'context': , - 'entity_id': 'sensor.buttoncounter_counter', + 'entity_id': 'sensor.input_buttoncounter_counter', 'last_changed': , 'last_reported': , 'last_updated': , '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': , @@ -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': , 'unit_of_measurement': 'illuminance', }), 'context': , - 'entity_id': 'sensor.lightsensor', + 'entity_id': 'sensor.input_lightsensor', 'last_changed': , 'last_reported': , 'last_updated': , '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': , @@ -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': , 'unit_of_measurement': 'm', }), 'context': , - 'entity_id': 'sensor.sensornumber', + 'entity_id': 'sensor.input_sensornumber', 'last_changed': , 'last_reported': , 'last_updated': , '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': , @@ -237,16 +237,16 @@ 'unit_of_measurement': , }) # --- -# 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': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.temperature', + 'entity_id': 'sensor.living_room_temperature', 'last_changed': , 'last_reported': , 'last_updated': , diff --git a/tests/components/velbus/snapshots/test_switch.ambr b/tests/components/velbus/snapshots/test_switch.ambr index 87f0f7eac02..e9090c396d1 100644 --- a/tests/components/velbus/snapshots/test_switch.ambr +++ b/tests/components/velbus/snapshots/test_switch.ambr @@ -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': , @@ -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': , - 'entity_id': 'switch.relayname', + 'entity_id': 'switch.living_room_relayname', 'last_changed': , 'last_reported': , 'last_updated': , diff --git a/tests/components/velbus/test_button.py b/tests/components/velbus/test_button.py index d1079497879..cf334a29b05 100644 --- a/tests/components/velbus/test_button.py +++ b/tests/components/velbus/test_button.py @@ -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() diff --git a/tests/components/velbus/test_climate.py b/tests/components/velbus/test_climate.py index fd0a268bb0f..c843bca6e68 100644 --- a/tests/components/velbus/test_climate.py +++ b/tests/components/velbus/test_climate.py @@ -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() diff --git a/tests/components/velbus/test_cover.py b/tests/components/velbus/test_cover.py index fe3fbbe1594..24a90e0f8d1 100644 --- a/tests/components/velbus/test_cover.py +++ b/tests/components/velbus/test_cover.py @@ -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) diff --git a/tests/components/velbus/test_init.py b/tests/components/velbus/test_init.py index 436a3d8fa95..3285099f2a2 100644 --- a/tests/components/velbus/test_init.py +++ b/tests/components/velbus/test_init.py @@ -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, ) diff --git a/tests/components/velbus/test_light.py b/tests/components/velbus/test_light.py index 344d1626bbd..0ce93d6e6bb 100644 --- a/tests/components/velbus/test_light.py +++ b/tests/components/velbus/test_light.py @@ -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") diff --git a/tests/components/velbus/test_select.py b/tests/components/velbus/test_select.py index 64ac2c98009..782ae53d440 100644 --- a/tests/components/velbus/test_select.py +++ b/tests/components/velbus/test_select.py @@ -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) diff --git a/tests/components/velbus/test_switch.py b/tests/components/velbus/test_switch.py index 9efb65af68d..ebb1da084c4 100644 --- a/tests/components/velbus/test_switch.py +++ b/tests/components/velbus/test_switch.py @@ -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()