Add new name handling for Shelly RPC devices (#60539)
This commit is contained in:
parent
0f2e39adee
commit
07c09ab268
3 changed files with 7 additions and 7 deletions
|
@ -57,9 +57,7 @@ def get_block_device_name(device: BlockDevice) -> str:
|
||||||
|
|
||||||
def get_rpc_device_name(device: RpcDevice) -> str:
|
def get_rpc_device_name(device: RpcDevice) -> str:
|
||||||
"""Naming for device."""
|
"""Naming for device."""
|
||||||
# Gen2 does not support setting device name
|
return cast(str, device.config["sys"]["device"]["name"] or device.hostname)
|
||||||
# AP SSID name is used as a nicely formatted device name
|
|
||||||
return cast(str, device.config["wifi"]["ap"]["ssid"] or device.hostname)
|
|
||||||
|
|
||||||
|
|
||||||
def get_number_of_channels(device: BlockDevice, block: Block) -> int:
|
def get_number_of_channels(device: BlockDevice, block: Block) -> int:
|
||||||
|
|
|
@ -58,9 +58,9 @@ MOCK_BLOCKS = [
|
||||||
MOCK_CONFIG = {
|
MOCK_CONFIG = {
|
||||||
"input:0": {"id": 0, "type": "button"},
|
"input:0": {"id": 0, "type": "button"},
|
||||||
"switch:0": {"name": "test switch_0"},
|
"switch:0": {"name": "test switch_0"},
|
||||||
"sys": {"ui_data": {}},
|
"sys": {
|
||||||
"wifi": {
|
"ui_data": {},
|
||||||
"ap": {"ssid": "Test name"},
|
"device": {"name": "Test name"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,9 @@ DISCOVERY_INFO = zeroconf.ZeroconfServiceInfo(
|
||||||
type="mock_type",
|
type="mock_type",
|
||||||
)
|
)
|
||||||
MOCK_CONFIG = {
|
MOCK_CONFIG = {
|
||||||
"wifi": {"ap": {"ssid": "Test name"}},
|
"sys": {
|
||||||
|
"device": {"name": "Test name"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue