Fix Shelly consumption_types (#106273)

pull/106460/head
Erik Montnemery 2023-12-22 22:58:59 +01:00 committed by Franck Nijhof
parent baa18eb0bd
commit 2bf5f8563e
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
1 changed files with 3 additions and 1 deletions

View File

@ -367,7 +367,9 @@ def is_block_channel_type_light(settings: dict[str, Any], channel: int) -> bool:
def is_rpc_channel_type_light(config: dict[str, Any], channel: int) -> bool:
"""Return true if rpc channel consumption type is set to light."""
con_types = config["sys"].get("ui_data", {}).get("consumption_types")
return con_types is not None and con_types[channel].lower().startswith("light")
if con_types is None or len(con_types) <= channel:
return False
return cast(str, con_types[channel]).lower().startswith("light")
def get_rpc_input_triggers(device: RpcDevice) -> list[tuple[str, str]]: