Add missing Shelly Cover sensors bugfix (#71831)

Switching Shelly Plus 2PM from switch to cover mode results in missing sensors for Power, Voltage, Energy and Temperature.

These parameters are still available in the API, but need to be accessed via "cover" key instead of "switch" key.

This change adds the missing sensors.
This commit is contained in:
RadekHvizdos 2022-05-15 11:29:35 +02:00 committed by Paulus Schoutsen
parent 5f3c7f11d8
commit 81f9cc40dd

View File

@ -297,6 +297,9 @@ def get_rpc_key_instances(keys_dict: dict[str, Any], key: str) -> list[str]:
if key in keys_dict:
return [key]
if key == "switch" and "cover:0" in keys_dict:
key = "cover"
keys_list: list[str] = []
for i in range(MAX_RPC_KEY_INSTANCES):
key_inst = f"{key}:{i}"