Change naming of Shelly entities to correspond with HA guidelines (#97533)

* Do not use the device name to create the entity name

* Remove unnecessary return

* Fix mypy complains

* Gen1

* Uncapitalize description.name if channel name is used

* Fix for climate and button

* switch_3 -> switch 3

* Add _attr_has_entity_name to ShellyRestAttributeEntity

* Capitalize channel name
This commit is contained in:
Maciej Bieniek 2023-08-19 09:13:22 +00:00 committed by GitHub
parent 7059252164
commit c526d23686
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 66 additions and 59 deletions

View file

@ -58,7 +58,7 @@ async def test_block_get_block_channel_name(mock_block_device, monkeypatch) -> N
mock_block_device,
mock_block_device.blocks[DEVICE_BLOCK_ID],
)
== "Test name channel 1"
== "Channel 1"
)
monkeypatch.setitem(mock_block_device.settings["device"], "type", "SHEM-3")
@ -68,7 +68,7 @@ async def test_block_get_block_channel_name(mock_block_device, monkeypatch) -> N
mock_block_device,
mock_block_device.blocks[DEVICE_BLOCK_ID],
)
== "Test name channel A"
== "Channel A"
)
monkeypatch.setitem(
@ -207,7 +207,7 @@ async def test_get_block_input_triggers(mock_block_device, monkeypatch) -> None:
async def test_get_rpc_channel_name(mock_rpc_device) -> None:
"""Test get RPC channel name."""
assert get_rpc_channel_name(mock_rpc_device, "input:0") == "test switch_0"
assert get_rpc_channel_name(mock_rpc_device, "input:3") == "Test name switch_3"
assert get_rpc_channel_name(mock_rpc_device, "input:3") == "Switch 3"
async def test_get_rpc_input_triggers(mock_rpc_device, monkeypatch) -> None: