From e6a214595b9bc5c75eb4ee27132891c6ded4be3c Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Thu, 25 May 2023 21:12:25 +0000 Subject: [PATCH] Avoid KeyError when specifying the consumption type in Shelly integration (#93561) Avoid KeyError when specifying the consumption type --- homeassistant/components/shelly/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/shelly/utils.py b/homeassistant/components/shelly/utils.py index 55c08620e81..c929e152b3f 100644 --- a/homeassistant/components/shelly/utils.py +++ b/homeassistant/components/shelly/utils.py @@ -348,7 +348,7 @@ 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"]["ui_data"].get("consumption_types") + con_types = config["sys"].get("ui_data", {}).get("consumption_types") return con_types is not None and con_types[channel].lower().startswith("light")