Fix Shelly RPC key instances handling (#86479)

Fix Shelly key instances handling
This commit is contained in:
Shay Levy 2023-01-23 22:12:29 +02:00 committed by GitHub
parent c1332f68b3
commit e15aaf2853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(