From e15aaf2853f7c9f7d57198ff411204c1b8529aef Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Mon, 23 Jan 2023 22:12:29 +0200 Subject: [PATCH] Fix Shelly RPC key instances handling (#86479) Fix Shelly key instances handling --- homeassistant/components/shelly/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/shelly/utils.py b/homeassistant/components/shelly/utils.py index 4183b527596..889e06cfe38 100644 --- a/homeassistant/components/shelly/utils.py +++ b/homeassistant/components/shelly/utils.py @@ -344,12 +344,12 @@ def get_rpc_key_instances(keys_dict: dict[str, Any], key: str) -> list[str]: if key == "switch" and "cover:0" in keys_dict: key = "cover" - return [k for k in keys_dict if k.startswith(key)] + return [k for k in keys_dict if k.startswith(f"{key}:")] def get_rpc_key_ids(keys_dict: dict[str, Any], key: str) -> list[int]: """Return list of key ids for RPC device from a dict.""" - return [int(k.split(":")[1]) for k in keys_dict if k.startswith(key)] + return [int(k.split(":")[1]) for k in keys_dict if k.startswith(f"{key}:")] def is_rpc_momentary_input(