mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 18:57:57 +00:00
Avoid KeyError when specifying the consumption type in Shelly integration (#93561)
Avoid KeyError when specifying the consumption type
This commit is contained in:
parent
eb058a3d41
commit
e6a214595b
@ -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:
|
def is_rpc_channel_type_light(config: dict[str, Any], channel: int) -> bool:
|
||||||
"""Return true if rpc channel consumption type is set to light."""
|
"""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")
|
return con_types is not None and con_types[channel].lower().startswith("light")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user