From 5e577058bb04b51eca6721fcbc6d16ff7e83567a Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Fri, 4 Feb 2022 02:19:36 +0200 Subject: [PATCH] Fix Shelly Plus i4 KeyError (#65604) --- homeassistant/components/shelly/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/shelly/utils.py b/homeassistant/components/shelly/utils.py index a01b5de133a..7a41c914e8a 100644 --- a/homeassistant/components/shelly/utils.py +++ b/homeassistant/components/shelly/utils.py @@ -264,7 +264,8 @@ def get_model_name(info: dict[str, Any]) -> str: def get_rpc_channel_name(device: RpcDevice, key: str) -> str: """Get name based on device and channel name.""" - key = key.replace("input", "switch") + if device.config.get("switch:0"): + key = key.replace("input", "switch") device_name = get_rpc_device_name(device) entity_name: str | None = device.config[key].get("name", device_name)