mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Provide beta release note for Shelly RPC devices (#136154)
* Return beta release note for Shelly RPC devices * Cleaning * Fix test * Move release note check
This commit is contained in:
parent
8c0515aff2
commit
5f67461c26
@ -237,6 +237,7 @@ OTA_SUCCESS = "ota_success"
|
||||
|
||||
GEN1_RELEASE_URL = "https://shelly-api-docs.shelly.cloud/gen1/#changelog"
|
||||
GEN2_RELEASE_URL = "https://shelly-api-docs.shelly.cloud/gen2/changelog/"
|
||||
GEN2_BETA_RELEASE_URL = f"{GEN2_RELEASE_URL}#unreleased"
|
||||
DEVICES_WITHOUT_FIRMWARE_CHANGELOG = (
|
||||
MODEL_WALL_DISPLAY,
|
||||
MODEL_MOTION,
|
||||
|
@ -50,6 +50,7 @@ from .const import (
|
||||
DOMAIN,
|
||||
FIRMWARE_UNSUPPORTED_ISSUE_ID,
|
||||
GEN1_RELEASE_URL,
|
||||
GEN2_BETA_RELEASE_URL,
|
||||
GEN2_RELEASE_URL,
|
||||
LOGGER,
|
||||
RPC_INPUTS_EVENTS_TYPES,
|
||||
@ -453,9 +454,14 @@ def mac_address_from_name(name: str) -> str | None:
|
||||
|
||||
def get_release_url(gen: int, model: str, beta: bool) -> str | None:
|
||||
"""Return release URL or None."""
|
||||
if beta or model in DEVICES_WITHOUT_FIRMWARE_CHANGELOG:
|
||||
if (
|
||||
beta and gen in BLOCK_GENERATIONS
|
||||
) or model in DEVICES_WITHOUT_FIRMWARE_CHANGELOG:
|
||||
return None
|
||||
|
||||
if beta:
|
||||
return GEN2_BETA_RELEASE_URL
|
||||
|
||||
return GEN1_RELEASE_URL if gen in BLOCK_GENERATIONS else GEN2_RELEASE_URL
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@ import pytest
|
||||
from homeassistant.components.shelly.const import (
|
||||
DOMAIN,
|
||||
GEN1_RELEASE_URL,
|
||||
GEN2_BETA_RELEASE_URL,
|
||||
GEN2_RELEASE_URL,
|
||||
)
|
||||
from homeassistant.components.update import (
|
||||
@ -572,7 +573,6 @@ async def test_rpc_beta_update(
|
||||
assert state.attributes[ATTR_LATEST_VERSION] == "1"
|
||||
assert state.attributes[ATTR_IN_PROGRESS] is False
|
||||
assert state.attributes[ATTR_UPDATE_PERCENTAGE] is None
|
||||
assert state.attributes[ATTR_RELEASE_URL] is None
|
||||
|
||||
monkeypatch.setitem(
|
||||
mock_rpc_device.status["sys"],
|
||||
@ -589,7 +589,7 @@ async def test_rpc_beta_update(
|
||||
assert state.attributes[ATTR_INSTALLED_VERSION] == "1"
|
||||
assert state.attributes[ATTR_LATEST_VERSION] == "2b"
|
||||
assert state.attributes[ATTR_IN_PROGRESS] is False
|
||||
assert state.attributes[ATTR_UPDATE_PERCENTAGE] is None
|
||||
assert state.attributes[ATTR_RELEASE_URL] == GEN2_BETA_RELEASE_URL
|
||||
|
||||
await hass.services.async_call(
|
||||
UPDATE_DOMAIN,
|
||||
|
@ -17,7 +17,11 @@ from aioshelly.const import (
|
||||
)
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.shelly.const import GEN1_RELEASE_URL, GEN2_RELEASE_URL
|
||||
from homeassistant.components.shelly.const import (
|
||||
GEN1_RELEASE_URL,
|
||||
GEN2_BETA_RELEASE_URL,
|
||||
GEN2_RELEASE_URL,
|
||||
)
|
||||
from homeassistant.components.shelly.utils import (
|
||||
get_block_channel_name,
|
||||
get_block_device_sleep_period,
|
||||
@ -300,7 +304,7 @@ async def test_get_rpc_input_triggers(
|
||||
(1, MODEL_1, True, None),
|
||||
(2, MODEL_WALL_DISPLAY, False, None),
|
||||
(2, MODEL_PLUS_2PM_V2, False, GEN2_RELEASE_URL),
|
||||
(2, MODEL_PLUS_2PM_V2, True, None),
|
||||
(2, MODEL_PLUS_2PM_V2, True, GEN2_BETA_RELEASE_URL),
|
||||
],
|
||||
)
|
||||
def test_get_release_url(
|
||||
|
Loading…
x
Reference in New Issue
Block a user