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 GitHub
parent 617b0d04dc
commit 8549af3855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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}"