From c92a90e04d418aacf188d8f4ba7f9625448f9d18 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Wed, 15 Nov 2023 15:45:33 +0100 Subject: [PATCH] Disable options flow for Shelly Wall Display (#103988) --- homeassistant/components/shelly/config_flow.py | 7 +++++-- homeassistant/components/shelly/const.py | 4 +++- tests/components/shelly/test_utils.py | 8 ++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/shelly/config_flow.py b/homeassistant/components/shelly/config_flow.py index bad13fde006..6cde265bc25 100644 --- a/homeassistant/components/shelly/config_flow.py +++ b/homeassistant/components/shelly/config_flow.py @@ -29,6 +29,7 @@ from .const import ( CONF_SLEEP_PERIOD, DOMAIN, LOGGER, + MODEL_WALL_DISPLAY, BLEScannerMode, ) from .coordinator import async_reconnect_soon, get_entry_data @@ -363,8 +364,10 @@ class ShellyConfigFlow(ConfigFlow, domain=DOMAIN): @callback def async_supports_options_flow(cls, config_entry: ConfigEntry) -> bool: """Return options flow support for this handler.""" - return config_entry.data.get("gen") == 2 and not config_entry.data.get( - CONF_SLEEP_PERIOD + return ( + config_entry.data.get("gen") == 2 + and not config_entry.data.get(CONF_SLEEP_PERIOD) + and config_entry.data.get("model") != MODEL_WALL_DISPLAY ) diff --git a/homeassistant/components/shelly/const.py b/homeassistant/components/shelly/const.py index 02dc347e495..95ffa2de91e 100644 --- a/homeassistant/components/shelly/const.py +++ b/homeassistant/components/shelly/const.py @@ -187,10 +187,12 @@ OTA_ERROR = "ota_error" OTA_PROGRESS = "ota_progress" OTA_SUCCESS = "ota_success" +MODEL_WALL_DISPLAY = "SAWD-0A1XX10EU1" + GEN1_RELEASE_URL = "https://shelly-api-docs.shelly.cloud/gen1/#changelog" GEN2_RELEASE_URL = "https://shelly-api-docs.shelly.cloud/gen2/changelog/" DEVICES_WITHOUT_FIRMWARE_CHANGELOG = ( - "SAWD-0A1XX10EU1", + MODEL_WALL_DISPLAY, "SHMOS-01", "SHMOS-02", "SHTRV-01", diff --git a/tests/components/shelly/test_utils.py b/tests/components/shelly/test_utils.py index cacef1fad71..07ba0d724c2 100644 --- a/tests/components/shelly/test_utils.py +++ b/tests/components/shelly/test_utils.py @@ -1,7 +1,11 @@ """Tests for Shelly utils.""" import pytest -from homeassistant.components.shelly.const import GEN1_RELEASE_URL, GEN2_RELEASE_URL +from homeassistant.components.shelly.const import ( + GEN1_RELEASE_URL, + GEN2_RELEASE_URL, + MODEL_WALL_DISPLAY, +) from homeassistant.components.shelly.utils import ( get_block_channel_name, get_block_device_sleep_period, @@ -234,7 +238,7 @@ async def test_get_rpc_input_triggers(mock_rpc_device, monkeypatch) -> None: (1, "SHMOS-01", False, None), (1, "SHSW-1", False, GEN1_RELEASE_URL), (1, "SHSW-1", True, None), - (2, "SAWD-0A1XX10EU1", False, None), + (2, MODEL_WALL_DISPLAY, False, None), (2, "SNSW-102P16EU", False, GEN2_RELEASE_URL), (2, "SNSW-102P16EU", True, None), ],