mirror of
https://github.com/home-assistant/core.git
synced 2025-04-19 14:57:52 +00:00
Remove Stookalert integration (#132569)
This commit is contained in:
parent
6c3e56748c
commit
eddb416f6d
@ -440,7 +440,6 @@ homeassistant.components.ssdp.*
|
||||
homeassistant.components.starlink.*
|
||||
homeassistant.components.statistics.*
|
||||
homeassistant.components.steamist.*
|
||||
homeassistant.components.stookalert.*
|
||||
homeassistant.components.stookwijzer.*
|
||||
homeassistant.components.stream.*
|
||||
homeassistant.components.streamlabswater.*
|
||||
|
@ -1422,8 +1422,6 @@ build.json @home-assistant/supervisor
|
||||
/homeassistant/components/steamist/ @bdraco
|
||||
/tests/components/steamist/ @bdraco
|
||||
/homeassistant/components/stiebel_eltron/ @fucm
|
||||
/homeassistant/components/stookalert/ @fwestenberg @frenck
|
||||
/tests/components/stookalert/ @fwestenberg @frenck
|
||||
/homeassistant/components/stookwijzer/ @fwestenberg
|
||||
/tests/components/stookwijzer/ @fwestenberg
|
||||
/homeassistant/components/stream/ @hunterjm @uvjustin @allenporter
|
||||
|
@ -1,29 +0,0 @@
|
||||
"""The Stookalert integration."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import stookalert
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import CONF_PROVINCE, DOMAIN
|
||||
|
||||
PLATFORMS = [Platform.BINARY_SENSOR]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up Stookalert from a config entry."""
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
hass.data[DOMAIN][entry.entry_id] = stookalert.stookalert(entry.data[CONF_PROVINCE])
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Unload Stookalert config entry."""
|
||||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
if unload_ok:
|
||||
del hass.data[DOMAIN][entry.entry_id]
|
||||
return unload_ok
|
@ -1,57 +0,0 @@
|
||||
"""Support for Stookalert Binary Sensor."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
import stookalert
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import CONF_PROVINCE, DOMAIN
|
||||
|
||||
SCAN_INTERVAL = timedelta(minutes=60)
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
entry: ConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up Stookalert binary sensor from a config entry."""
|
||||
client = hass.data[DOMAIN][entry.entry_id]
|
||||
async_add_entities([StookalertBinarySensor(client, entry)], update_before_add=True)
|
||||
|
||||
|
||||
class StookalertBinarySensor(BinarySensorEntity):
|
||||
"""Defines a Stookalert binary sensor."""
|
||||
|
||||
_attr_attribution = "Data provided by rivm.nl"
|
||||
_attr_device_class = BinarySensorDeviceClass.SAFETY
|
||||
_attr_has_entity_name = True
|
||||
_attr_name = None
|
||||
|
||||
def __init__(self, client: stookalert.stookalert, entry: ConfigEntry) -> None:
|
||||
"""Initialize a Stookalert device."""
|
||||
self._client = client
|
||||
self._attr_unique_id = entry.unique_id
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, f"{entry.entry_id}")},
|
||||
name=f"Stookalert {entry.data[CONF_PROVINCE]}",
|
||||
manufacturer="RIVM",
|
||||
model="Stookalert",
|
||||
entry_type=DeviceEntryType.SERVICE,
|
||||
configuration_url="https://www.rivm.nl/stookalert",
|
||||
)
|
||||
|
||||
def update(self) -> None:
|
||||
"""Update the data from the Stookalert handler."""
|
||||
self._client.get_alerts()
|
||||
self._attr_is_on = self._client.state == 1
|
@ -1,33 +0,0 @@
|
||||
"""Config flow to configure the Stookalert integration."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||
|
||||
from .const import CONF_PROVINCE, DOMAIN, PROVINCES
|
||||
|
||||
|
||||
class StookalertFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
"""Config flow for Stookalert."""
|
||||
|
||||
VERSION = 1
|
||||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle a flow initialized by the user."""
|
||||
if user_input is not None:
|
||||
await self.async_set_unique_id(user_input[CONF_PROVINCE])
|
||||
self._abort_if_unique_id_configured()
|
||||
return self.async_create_entry(
|
||||
title=user_input[CONF_PROVINCE], data=user_input
|
||||
)
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
data_schema=vol.Schema({vol.Required(CONF_PROVINCE): vol.In(PROVINCES)}),
|
||||
)
|
@ -1,24 +0,0 @@
|
||||
"""Constants for the Stookalert integration."""
|
||||
|
||||
import logging
|
||||
from typing import Final
|
||||
|
||||
DOMAIN: Final = "stookalert"
|
||||
LOGGER = logging.getLogger(__package__)
|
||||
|
||||
CONF_PROVINCE: Final = "province"
|
||||
|
||||
PROVINCES: Final = (
|
||||
"Drenthe",
|
||||
"Flevoland",
|
||||
"Friesland",
|
||||
"Gelderland",
|
||||
"Groningen",
|
||||
"Limburg",
|
||||
"Noord-Brabant",
|
||||
"Noord-Holland",
|
||||
"Overijssel",
|
||||
"Utrecht",
|
||||
"Zeeland",
|
||||
"Zuid-Holland",
|
||||
)
|
@ -1,20 +0,0 @@
|
||||
"""Diagnostics support for Stookalert."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import stookalert
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
async def async_get_config_entry_diagnostics(
|
||||
hass: HomeAssistant, entry: ConfigEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
client: stookalert.stookalert = hass.data[DOMAIN][entry.entry_id]
|
||||
return {"state": client.state}
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"domain": "stookalert",
|
||||
"name": "RIVM Stookalert",
|
||||
"codeowners": ["@fwestenberg", "@frenck"],
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/stookalert",
|
||||
"integration_type": "service",
|
||||
"iot_class": "cloud_polling",
|
||||
"requirements": ["stookalert==0.1.4"]
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"data": {
|
||||
"province": "Province"
|
||||
}
|
||||
}
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_service%]"
|
||||
}
|
||||
}
|
||||
}
|
@ -574,7 +574,6 @@ FLOWS = {
|
||||
"starlink",
|
||||
"steam_online",
|
||||
"steamist",
|
||||
"stookalert",
|
||||
"stookwijzer",
|
||||
"streamlabswater",
|
||||
"subaru",
|
||||
|
@ -5951,12 +5951,6 @@
|
||||
"config_flow": false,
|
||||
"iot_class": "local_polling"
|
||||
},
|
||||
"stookalert": {
|
||||
"name": "RIVM Stookalert",
|
||||
"integration_type": "service",
|
||||
"config_flow": true,
|
||||
"iot_class": "cloud_polling"
|
||||
},
|
||||
"stookwijzer": {
|
||||
"name": "Stookwijzer",
|
||||
"integration_type": "service",
|
||||
|
10
mypy.ini
10
mypy.ini
@ -4156,16 +4156,6 @@ disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.stookalert.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
disallow_subclassing_any = true
|
||||
disallow_untyped_calls = true
|
||||
disallow_untyped_decorators = true
|
||||
disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.stookwijzer.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
|
@ -2742,9 +2742,6 @@ statsd==3.2.1
|
||||
# homeassistant.components.steam_online
|
||||
steamodd==4.21
|
||||
|
||||
# homeassistant.components.stookalert
|
||||
stookalert==0.1.4
|
||||
|
||||
# homeassistant.components.stookwijzer
|
||||
stookwijzer==1.5.1
|
||||
|
||||
|
@ -2194,9 +2194,6 @@ statsd==3.2.1
|
||||
# homeassistant.components.steam_online
|
||||
steamodd==4.21
|
||||
|
||||
# homeassistant.components.stookalert
|
||||
stookalert==0.1.4
|
||||
|
||||
# homeassistant.components.stookwijzer
|
||||
stookwijzer==1.5.1
|
||||
|
||||
|
@ -990,7 +990,6 @@ INTEGRATIONS_WITHOUT_QUALITY_SCALE_FILE = [
|
||||
"steam_online",
|
||||
"steamist",
|
||||
"stiebel_eltron",
|
||||
"stookalert",
|
||||
"stream",
|
||||
"streamlabswater",
|
||||
"subaru",
|
||||
|
@ -1 +0,0 @@
|
||||
"""Tests for the Stookalert integration."""
|
@ -1,59 +0,0 @@
|
||||
"""Tests for the Stookalert config flow."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.stookalert.const import CONF_PROVINCE, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_full_user_flow(hass: HomeAssistant) -> None:
|
||||
"""Test the full user configuration flow."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result.get("type") is FlowResultType.FORM
|
||||
assert result.get("step_id") == "user"
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.stookalert.async_setup_entry", return_value=True
|
||||
) as mock_setup_entry:
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={
|
||||
CONF_PROVINCE: "Overijssel",
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") is FlowResultType.CREATE_ENTRY
|
||||
assert result2.get("title") == "Overijssel"
|
||||
assert result2.get("data") == {
|
||||
CONF_PROVINCE: "Overijssel",
|
||||
}
|
||||
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_already_configured(hass: HomeAssistant) -> None:
|
||||
"""Test we abort if the Stookalert province is already configured."""
|
||||
MockConfigEntry(
|
||||
domain=DOMAIN, data={CONF_PROVINCE: "Overijssel"}, unique_id="Overijssel"
|
||||
).add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={
|
||||
CONF_PROVINCE: "Overijssel",
|
||||
},
|
||||
)
|
||||
|
||||
assert result2.get("type") is FlowResultType.ABORT
|
||||
assert result2.get("reason") == "already_configured"
|
Loading…
x
Reference in New Issue
Block a user