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(