From 896df60f3260815cb03f70b2a29ecad6ce73d1c3 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 10 Sep 2020 12:08:17 +0200 Subject: [PATCH] Shelly switch to guard for shelly 2 in roller mode (#39886) --- homeassistant/components/shelly/switch.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/homeassistant/components/shelly/switch.py b/homeassistant/components/shelly/switch.py index 1c3c48637e9..5550240478f 100644 --- a/homeassistant/components/shelly/switch.py +++ b/homeassistant/components/shelly/switch.py @@ -13,6 +13,10 @@ async def async_setup_entry(hass, config_entry, async_add_entities): """Set up switches for device.""" wrapper = hass.data[DOMAIN][config_entry.entry_id] + # In roller mode the relay blocks exist but do not contain required info + if wrapper.model == "SHSW-25" and wrapper.device.settings["mode"] != "relay": + return + relay_blocks = [block for block in wrapper.device.blocks if block.type == "relay"] if not relay_blocks: