mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add new name handling for Shelly RPC devices (#60539)
This commit is contained in:
parent
0f2e39adee
commit
07c09ab268
@ -57,9 +57,7 @@ def get_block_device_name(device: BlockDevice) -> str:
|
||||
|
||||
def get_rpc_device_name(device: RpcDevice) -> str:
|
||||
"""Naming for device."""
|
||||
# Gen2 does not support setting device name
|
||||
# AP SSID name is used as a nicely formatted device name
|
||||
return cast(str, device.config["wifi"]["ap"]["ssid"] or device.hostname)
|
||||
return cast(str, device.config["sys"]["device"]["name"] or device.hostname)
|
||||
|
||||
|
||||
def get_number_of_channels(device: BlockDevice, block: Block) -> int:
|
||||
|
@ -58,9 +58,9 @@ MOCK_BLOCKS = [
|
||||
MOCK_CONFIG = {
|
||||
"input:0": {"id": 0, "type": "button"},
|
||||
"switch:0": {"name": "test switch_0"},
|
||||
"sys": {"ui_data": {}},
|
||||
"wifi": {
|
||||
"ap": {"ssid": "Test name"},
|
||||
"sys": {
|
||||
"ui_data": {},
|
||||
"device": {"name": "Test name"},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,9 @@ DISCOVERY_INFO = zeroconf.ZeroconfServiceInfo(
|
||||
type="mock_type",
|
||||
)
|
||||
MOCK_CONFIG = {
|
||||
"wifi": {"ap": {"ssid": "Test name"}},
|
||||
"sys": {
|
||||
"device": {"name": "Test name"},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user