Disable options flow for Shelly Wall Display (#103988)

pull/104037/head^2
Maciej Bieniek 2023-11-15 15:45:33 +01:00 committed by GitHub
parent cf3a2741c5
commit c92a90e04d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -29,6 +29,7 @@ from .const import (
CONF_SLEEP_PERIOD, CONF_SLEEP_PERIOD,
DOMAIN, DOMAIN,
LOGGER, LOGGER,
MODEL_WALL_DISPLAY,
BLEScannerMode, BLEScannerMode,
) )
from .coordinator import async_reconnect_soon, get_entry_data from .coordinator import async_reconnect_soon, get_entry_data
@ -363,8 +364,10 @@ class ShellyConfigFlow(ConfigFlow, domain=DOMAIN):
@callback @callback
def async_supports_options_flow(cls, config_entry: ConfigEntry) -> bool: def async_supports_options_flow(cls, config_entry: ConfigEntry) -> bool:
"""Return options flow support for this handler.""" """Return options flow support for this handler."""
return config_entry.data.get("gen") == 2 and not config_entry.data.get( return (
CONF_SLEEP_PERIOD config_entry.data.get("gen") == 2
and not config_entry.data.get(CONF_SLEEP_PERIOD)
and config_entry.data.get("model") != MODEL_WALL_DISPLAY
) )

View File

@ -187,10 +187,12 @@ OTA_ERROR = "ota_error"
OTA_PROGRESS = "ota_progress" OTA_PROGRESS = "ota_progress"
OTA_SUCCESS = "ota_success" OTA_SUCCESS = "ota_success"
MODEL_WALL_DISPLAY = "SAWD-0A1XX10EU1"
GEN1_RELEASE_URL = "https://shelly-api-docs.shelly.cloud/gen1/#changelog" GEN1_RELEASE_URL = "https://shelly-api-docs.shelly.cloud/gen1/#changelog"
GEN2_RELEASE_URL = "https://shelly-api-docs.shelly.cloud/gen2/changelog/" GEN2_RELEASE_URL = "https://shelly-api-docs.shelly.cloud/gen2/changelog/"
DEVICES_WITHOUT_FIRMWARE_CHANGELOG = ( DEVICES_WITHOUT_FIRMWARE_CHANGELOG = (
"SAWD-0A1XX10EU1", MODEL_WALL_DISPLAY,
"SHMOS-01", "SHMOS-01",
"SHMOS-02", "SHMOS-02",
"SHTRV-01", "SHTRV-01",

View File

@ -1,7 +1,11 @@
"""Tests for Shelly utils.""" """Tests for Shelly utils."""
import pytest 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 ( from homeassistant.components.shelly.utils import (
get_block_channel_name, get_block_channel_name,
get_block_device_sleep_period, 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, "SHMOS-01", False, None),
(1, "SHSW-1", False, GEN1_RELEASE_URL), (1, "SHSW-1", False, GEN1_RELEASE_URL),
(1, "SHSW-1", True, None), (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", False, GEN2_RELEASE_URL),
(2, "SNSW-102P16EU", True, None), (2, "SNSW-102P16EU", True, None),
], ],