Merge pull request #65606 from home-assistant/rc

This commit is contained in:
Paulus Schoutsen 2022-02-03 16:57:24 -08:00 committed by GitHub
commit f44f1f0c4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -227,7 +227,7 @@ def _async_subscribe_pico_remote_events(
action = ACTION_RELEASE action = ACTION_RELEASE
type_ = device["type"] type_ = device["type"]
name = device["name"] area, name = device["name"].split("_", 1)
button_number = device["button_number"] button_number = device["button_number"]
# The original implementation used LIP instead of LEAP # The original implementation used LIP instead of LEAP
# so we need to convert the button number to maintain compat # so we need to convert the button number to maintain compat
@ -252,7 +252,7 @@ def _async_subscribe_pico_remote_events(
ATTR_BUTTON_NUMBER: lip_button_number, ATTR_BUTTON_NUMBER: lip_button_number,
ATTR_LEAP_BUTTON_NUMBER: button_number, ATTR_LEAP_BUTTON_NUMBER: button_number,
ATTR_DEVICE_NAME: name, ATTR_DEVICE_NAME: name,
ATTR_AREA_NAME: name.split("_")[0], ATTR_AREA_NAME: area,
ATTR_ACTION: action, ATTR_ACTION: action,
}, },
) )

View File

@ -264,6 +264,7 @@ def get_model_name(info: dict[str, Any]) -> str:
def get_rpc_channel_name(device: RpcDevice, key: str) -> str: def get_rpc_channel_name(device: RpcDevice, key: str) -> str:
"""Get name based on device and channel name.""" """Get name based on device and channel name."""
if device.config.get("switch:0"):
key = key.replace("input", "switch") key = key.replace("input", "switch")
device_name = get_rpc_device_name(device) device_name = get_rpc_device_name(device)
entity_name: str | None = device.config[key].get("name", device_name) entity_name: str | None = device.config[key].get("name", device_name)