Compare commits

...

13 Commits

Author SHA1 Message Date
Lukas Svoboda 6edaec73d8
Merge pull request #83 from schizza/recactor/fixes
Recactor/fixes
2025-11-17 00:29:50 +01:00
Lukas Svoboda 44d0ee5c7b
Merge branch 'stable' into recactor/fixes 2025-11-17 00:29:40 +01:00
SchiZzA e482fcea2b
Fix typecheck issues 2025-11-17 00:28:37 +01:00
Lukas Svoboda 826a9a71cc
Merge pull request #82 from schizza/readme_update
Update README
2025-11-16 22:40:14 +01:00
SchiZzA 08de8b5570
Update README 2025-11-16 22:36:05 +01:00
SchiZzA 0679f1e559
Fix typos, fix await in windy_func 2025-11-16 19:18:29 +01:00
Lukas Svoboda 0c42c8d827
Merge pull request #81 from schizza/feature/pocasi_cz
Support for resending data to Pocasi Meteo CZ
2025-11-16 19:09:53 +01:00
SchiZzA de346ed914
Fix: Retain dat for other options, while configuring Pocasi CZ 2025-11-16 19:02:24 +01:00
SchiZzA 7950e1be46
Add Pocasi CZ push to server support
Added `pocasi_cz.py` component to handle resending data to Pocasi CZ
server.
2025-11-16 18:37:01 +01:00
SchiZzA 0d47e14834
Add Počasí Meteo CZ integration to options flow and constants
Introduce new config step for Počasí Meteo CZ with validation and UI
schema. Define related constants and translation keys for setting up
data forwarding.
2025-11-16 15:37:13 +01:00
SchiZzA 92eadbb4e2
Typo update 2025-11-16 14:09:16 +01:00
SchiZzA 040f70c027
Adds translation keys.
Updated cs.json, en.json, strings,json
2025-11-16 13:38:11 +01:00
SchiZzA 67d8acf9cc
Add constants for `pocasimeteo_cz`
const `POCASI_CZ_URL` added to constants. cont `POCASI_CZ_SEDN_INTERVAL`
and POCASI_CZ_SEND_MINIMUM are added to contants.
2025-11-16 13:13:41 +01:00
13 changed files with 617 additions and 167 deletions

View File

@ -102,6 +102,16 @@ As soon as the integration is added into Home Assistant it will listen for incom
- You are done.
## Resending data to Pocasi Meteo
- If you are willing to use [Pocasi Meteo Application](https://pocasimeteo.cz) you can enable resending your data to their servers
- You must have account at Pocasi Meteo, where you will recieve `ID` and `KEY`, which are needed to connect to server
- In `Settings` -> `Devices & services` find SWS12500 and click `Configure`.
- In dialog box choose `Pocasi Meteo configuration`.
- Fill in `ID` and `KEY` you were provided at `Pocasi Meteo`.
- Tick `Enable` checkbox.
- You are done.
## WSLink notes
While your station is using WSLink you have to have Home Assistant in SSL mode or behind SSL proxy server.

View File

@ -2,7 +2,7 @@
import logging
import aiohttp
import aiohttp.web
from aiohttp.web_exceptions import HTTPUnauthorized
from homeassistant.config_entries import ConfigEntry
@ -17,11 +17,13 @@ from .const import (
DEFAULT_URL,
DEV_DBG,
DOMAIN,
POCASI_CZ_ENABLED,
SENSORS_TO_LOAD,
WINDY_ENABLED,
WSLINK,
WSLINK_URL,
)
from .pocasti_cz import PocasiPush
from .routes import Routes, unregistred
from .utils import (
anonymize,
@ -51,6 +53,7 @@ class WeatherDataUpdateCoordinator(DataUpdateCoordinator):
self.hass = hass
self.config = config
self.windy = WindyPush(hass, config)
self.pocasi: PocasiPush = PocasiPush(hass, config)
super().__init__(hass, _LOGGER, name=DOMAIN)
async def recieved_data(self, webdata):
@ -85,6 +88,9 @@ class WeatherDataUpdateCoordinator(DataUpdateCoordinator):
if self.config_entry.options.get(WINDY_ENABLED):
response = await self.windy.push_data_to_windy(data)
if self.config.options.get(POCASI_CZ_ENABLED):
await self.pocasi.push_data_to_server(data, "WSLINK" if _wslink else "WU")
remaped_items = (
remap_wslink_items(data)
if self.config_entry.options.get(WSLINK)
@ -134,11 +140,11 @@ def register_path(
hass_data = hass.data.setdefault(DOMAIN, {})
debug = config.options.get(DEV_DBG)
_wslink = config.options.get(WSLINK)
_wslink = config.options.get(WSLINK, False)
routes: Routes = hass_data.get("routes") if "routes" in hass_data else None
routes: Routes = hass_data.get("routes", Routes())
if routes is None:
if not routes.routes:
routes = Routes()
_LOGGER.info("Routes not found, creating new routes")

View File

@ -4,7 +4,7 @@ from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow, OptionsFlow
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
from homeassistant.core import callback
from homeassistant.exceptions import HomeAssistantError
@ -14,6 +14,12 @@ from .const import (
DEV_DBG,
DOMAIN,
INVALID_CREDENTIALS,
POCASI_CZ_API_ID,
POCASI_CZ_API_KEY,
POCASI_CZ_ENABLED,
POCASI_CZ_LOGGER_ENABLED,
POCASI_CZ_SEND_INTERVAL,
POCASI_CZ_SEND_MINIMUM,
SENSORS_TO_LOAD,
WINDY_API_KEY,
WINDY_ENABLED,
@ -43,6 +49,8 @@ class ConfigOptionsFlowHandler(OptionsFlow):
self.user_data_schema = {}
self.sensors: dict[str, Any] = {}
self.migrate_schema = {}
self.pocasi_cz: dict[str, Any] = {}
self.pocasi_cz_schema = {}
@property
def config_entry(self):
@ -51,7 +59,7 @@ class ConfigOptionsFlowHandler(OptionsFlow):
async def _get_entry_data(self):
"""Get entry data."""
self.user_data: dict[str, Any] = {
self.user_data = {
API_ID: self.config_entry.options.get(API_ID),
API_KEY: self.config_entry.options.get(API_KEY),
WSLINK: self.config_entry.options.get(WSLINK, False),
@ -65,7 +73,7 @@ class ConfigOptionsFlowHandler(OptionsFlow):
vol.Optional(DEV_DBG, default=self.user_data.get(DEV_DBG, False)): bool,
}
self.sensors: dict[str, Any] = {
self.sensors = {
SENSORS_TO_LOAD: (
self.config_entry.options.get(SENSORS_TO_LOAD)
if isinstance(self.config_entry.options.get(SENSORS_TO_LOAD), list)
@ -73,7 +81,7 @@ class ConfigOptionsFlowHandler(OptionsFlow):
)
}
self.windy_data: dict[str, Any] = {
self.windy_data = {
WINDY_API_KEY: self.config_entry.options.get(WINDY_API_KEY),
WINDY_ENABLED: self.config_entry.options.get(WINDY_ENABLED, False),
WINDY_LOGGER_ENABLED: self.config_entry.options.get(
@ -90,13 +98,46 @@ class ConfigOptionsFlowHandler(OptionsFlow):
vol.Optional(
WINDY_LOGGER_ENABLED,
default=self.windy_data[WINDY_LOGGER_ENABLED],
): bool
or False,
): bool or False,
}
self.pocasi_cz = {
POCASI_CZ_API_ID: self.config_entry.options.get(POCASI_CZ_API_ID, ""),
POCASI_CZ_API_KEY: self.config_entry.options.get(POCASI_CZ_API_KEY, ""),
POCASI_CZ_ENABLED: self.config_entry.options.get(POCASI_CZ_ENABLED, False),
POCASI_CZ_LOGGER_ENABLED: self.config_entry.options.get(
POCASI_CZ_LOGGER_ENABLED, False
),
POCASI_CZ_SEND_INTERVAL: self.config_entry.options.get(
POCASI_CZ_SEND_INTERVAL, 30
),
}
self.pocasi_cz_schema = {
vol.Required(
POCASI_CZ_API_ID, default=self.pocasi_cz.get(POCASI_CZ_API_ID)
): str,
vol.Required(
POCASI_CZ_API_KEY, default=self.pocasi_cz.get(POCASI_CZ_API_KEY)
): str,
vol.Required(
POCASI_CZ_SEND_INTERVAL,
default=self.pocasi_cz.get(POCASI_CZ_SEND_INTERVAL),
): int,
vol.Optional(
POCASI_CZ_ENABLED, default=self.pocasi_cz.get(POCASI_CZ_ENABLED)
): bool,
vol.Optional(
POCASI_CZ_LOGGER_ENABLED,
default=self.pocasi_cz.get(POCASI_CZ_LOGGER_ENABLED),
): bool,
}
async def async_step_init(self, user_input=None):
"""Manage the options - show menu first."""
return self.async_show_menu(step_id="init", menu_options=["basic", "windy"])
return self.async_show_menu(
step_id="init", menu_options=["basic", "windy", "pocasi"]
)
async def async_step_basic(self, user_input=None):
"""Manage basic options - credentials."""
@ -124,6 +165,9 @@ class ConfigOptionsFlowHandler(OptionsFlow):
# retain sensors
user_input.update(self.sensors)
# retain pocasi data
user_input.update(self.pocasi_cz)
return self.async_create_entry(title=DOMAIN, data=user_input)
self.user_data = user_input
@ -162,10 +206,54 @@ class ConfigOptionsFlowHandler(OptionsFlow):
# retain senors
user_input.update(self.sensors)
# retain pocasi cz
user_input.update(self.pocasi_cz)
return self.async_create_entry(title=DOMAIN, data=user_input)
async def async_step_pocasi(self, user_input: Any = None) -> ConfigFlowResult:
"""Handle the pocasi step."""
errors = {}
await self._get_entry_data()
if user_input is None:
return self.async_show_form(
step_id="pocasi",
data_schema=vol.Schema(self.pocasi_cz_schema),
errors=errors,
)
if user_input.get(POCASI_CZ_SEND_INTERVAL, 0) < POCASI_CZ_SEND_MINIMUM:
errors[POCASI_CZ_SEND_INTERVAL] = "pocasi_send_minimum"
if user_input.get(POCASI_CZ_ENABLED):
if user_input.get(POCASI_CZ_API_ID) == "":
errors[POCASI_CZ_API_ID] = "pocasi_id_required"
if user_input.get(POCASI_CZ_API_KEY) == "":
errors[POCASI_CZ_API_KEY] = "pocasi_key_required"
if len(errors) > 0:
return self.async_show_form(
step_id="pocasi",
data_schema=vol.Schema(self.pocasi_cz_schema),
errors=errors,
)
# retain user data
user_input.update(self.user_data)
# retain senors
user_input.update(self.sensors)
# retain windy
user_input.update(self.windy_data)
return self.async_create_entry(title=DOMAIN, data=user_input)
class ConfigFlow(ConfigFlow, domain=DOMAIN):
class ConfigFlowHandler(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Sencor SWS 12500 Weather Station."""
data_schema = {

View File

@ -9,6 +9,9 @@ WSLINK_URL = "/data/upload.php"
WINDY_URL = "https://stations.windy.com/pws/update/"
DATABASE_PATH = "/config/home-assistant_v2.db"
POCASI_CZ_URL: Final = "http://ms.pocasimeteo.cz"
POCASI_CZ_SEND_MINIMUM: Final = 12 # minimal time to resend data
ICON = "mdi:weather"
API_KEY = "API_KEY"
@ -20,6 +23,19 @@ SENSOR_TO_MIGRATE: Final = "sensor_to_migrate"
DEV_DBG: Final = "dev_debug_checkbox"
WSLINK: Final = "wslink"
POCASI_CZ_API_KEY = "POCASI_CZ_API_KEY"
POCASI_CZ_API_ID = "POCASI_CZ_API_ID"
POCASI_CZ_SEND_INTERVAL = "POCASI_SEND_INTERVAL"
POCASI_CZ_ENABLED = "pocasi_enabled_chcekbox"
POCASI_CZ_LOGGER_ENABLED = "pocasi_logger_checkbox"
POCASI_INVALID_KEY: Final = (
"Pocasi Meteo refused to accept data. Invalid ID/Key combination?"
)
POCASI_CZ_SUCCESS: Final = "Successfully sent data to Pocasi Meteo"
POCASI_CZ_UNEXPECTED: Final = (
"Pocasti Meteo responded unexpectedly 3 times in row. Resendig is now disabled!"
)
WINDY_API_KEY = "WINDY_API_KEY"
WINDY_ENABLED: Final = "windy_enabled_checkbox"
WINDY_LOGGER_ENABLED: Final = "windy_logger_checkbox"
@ -57,6 +73,13 @@ PURGE_DATA: Final = [
"dailyrainin",
]
PURGE_DATA_POCAS: Final = [
"ID",
"PASSWORD",
"action",
"rtfreq",
]
BARO_PRESSURE: Final = "baro_pressure"
OUTSIDE_TEMP: Final = "outside_temp"

View File

@ -0,0 +1,143 @@
"""Pocasi CZ resend functions."""
from datetime import datetime, timedelta
import logging
from typing import Any, Literal
from aiohttp import ClientError
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import (
DEFAULT_URL,
POCASI_CZ_API_ID,
POCASI_CZ_API_KEY,
POCASI_CZ_ENABLED,
POCASI_CZ_LOGGER_ENABLED,
POCASI_CZ_SEND_INTERVAL,
POCASI_CZ_SUCCESS,
POCASI_CZ_UNEXPECTED,
POCASI_CZ_URL,
POCASI_INVALID_KEY,
WSLINK_URL,
)
from .utils import update_options
_LOGGER = logging.getLogger(__name__)
class PocasiNotInserted(Exception):
"""NotInserted state."""
class PocasiSuccess(Exception):
"""WindySucces state."""
class PocasiApiKeyError(Exception):
"""Windy API Key error."""
class PocasiPush:
"""Push data to Windy."""
def __init__(self, hass: HomeAssistant, config: ConfigEntry) -> None:
"""Init."""
self.hass = hass
self.config = config
self._interval = int(self.config.options.get(POCASI_CZ_SEND_INTERVAL, 30))
self.last_update = datetime.now()
self.next_update = datetime.now() + timedelta(seconds=self._interval)
self.log = self.config.options.get(POCASI_CZ_LOGGER_ENABLED)
self.invalid_response_count = 0
def verify_response(
self,
response: str,
) -> PocasiNotInserted | PocasiSuccess | PocasiApiKeyError | None:
"""Verify answer form server."""
if self.log:
_LOGGER.debug("Pocasi CZ responded: %s", response)
# Server does not provide any responses.
# This is placeholder if future state is changed
return None
async def push_data_to_server(
self, data: dict[str, Any], mode: Literal["WU", "WSLINK"]
):
"""Pushes weather data to server."""
_data = data.copy()
_api_id = self.config.options.get(POCASI_CZ_API_ID)
_api_key = self.config.options.get(POCASI_CZ_API_KEY)
if self.log:
_LOGGER.info(
"Pocasi CZ last update = %s, next update at: %s",
str(self.last_update),
str(self.next_update),
)
if self.next_update > datetime.now():
_LOGGER.debug(
"Triggered update interval limit of %s seconds. Next possilbe update is set to: %s",
self._interval,
self.next_update,
)
return False
request_url: str = ""
if mode == "WSLINK":
_data["wsid"] = _api_id
_data["wspw"] = _api_key
request_url = f"{POCASI_CZ_URL}{WSLINK_URL}"
if mode == "WU":
_data["ID"] = _api_id
_data["PASSWORD"] = _api_key
request_url = f"{POCASI_CZ_URL}{DEFAULT_URL}"
session = async_get_clientsession(self.hass, verify_ssl=False)
_LOGGER.debug(
"Payload for Pocasi Meteo server: [mode=%s] [request_url=%s] = %s",
mode,
request_url,
_data,
)
try:
async with session.get(request_url, params=_data) as resp:
status = await resp.text()
try:
self.verify_response(status)
except PocasiApiKeyError:
# log despite of settings
_LOGGER.critical(POCASI_INVALID_KEY)
await update_options(
self.hass, self.config, POCASI_CZ_ENABLED, False
)
except PocasiSuccess:
if self.log:
_LOGGER.info(POCASI_CZ_SUCCESS)
except ClientError as ex:
_LOGGER.critical("Invalid response from Pocasi Meteo: %s", str(ex))
self.invalid_response_count += 1
if self.invalid_response_count > 3:
_LOGGER.critical(POCASI_CZ_UNEXPECTED)
await update_options(self.hass, self.config, POCASI_CZ_ENABLED, False)
self.last_update = datetime.now()
self.next_update = datetime.now() + timedelta(seconds=self._interval)
if self.log:
_LOGGER.info("Next update: %s", str(self.next_update))
return None

View File

@ -1,5 +1,6 @@
"""Store routes info."""
from collections.abc import Callable
from dataclasses import dataclass
from logging import getLogger
@ -14,7 +15,7 @@ class Route:
url_path: str
route: AbstractRoute
handler: callable
handler: Callable
enabled: bool = False
def __str__(self):
@ -29,7 +30,7 @@ class Routes:
"""Initialize routes."""
self.routes = {}
def switch_route(self, coordinator: callable, url_path: str):
def switch_route(self, coordinator: Callable, url_path: str):
"""Switch route."""
for url, route in self.routes.items():
@ -47,7 +48,7 @@ class Routes:
self,
url_path: str,
route: AbstractRoute,
handler: callable,
handler: Callable,
enabled: bool = False,
):
"""Add route."""
@ -55,7 +56,7 @@ class Routes:
def get_route(self, url_path: str) -> Route:
"""Get route."""
return self.routes.get(url_path)
return self.routes.get(url_path, Route)
def get_enabled(self) -> str:
"""Get enabled routes."""

View File

@ -2,7 +2,7 @@
import logging
from homeassistant.components.sensor import RestoreSensor, SensorEntity
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.device_registry import DeviceEntryType
@ -12,10 +12,10 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import WeatherDataUpdateCoordinator
from .const import (
BATTERY_LIST,
CHILL_INDEX,
DOMAIN,
HEAT_INDEX,
OUTSIDE_BATTERY,
OUTSIDE_HUMIDITY,
OUTSIDE_TEMP,
SENSORS_TO_LOAD,
@ -23,12 +23,12 @@ from .const import (
WIND_DIR,
WIND_SPEED,
WSLINK,
BATTERY_LIST,
UnitOfBat,
)
from .sensors_common import WeatherSensorEntityDescription
from .sensors_weather import SENSOR_TYPES_WEATHER_API
from .sensors_wslink import SENSOR_TYPES_WSLINK
from .utils import chill_index, heat_index, battery_level_to_icon, battery_level_to_text
from .utils import battery_level_to_icon, battery_level_to_text, chill_index, heat_index
_LOGGER = logging.getLogger(__name__)
@ -44,12 +44,12 @@ async def async_setup_entry(
sensors_to_load: list = []
sensors: list = []
_wslink = config_entry.data.get(WSLINK)
_wslink = config_entry.options.get(WSLINK)
SENSOR_TYPES = SENSOR_TYPES_WSLINK if _wslink else SENSOR_TYPES_WEATHER_API
# Check if we have some sensors to load.
if sensors_to_load := config_entry.options.get(SENSORS_TO_LOAD):
if sensors_to_load := config_entry.options.get(SENSORS_TO_LOAD, []):
if WIND_DIR in sensors_to_load:
sensors_to_load.append(WIND_AZIMUT)
if (OUTSIDE_HUMIDITY in sensors_to_load) and (OUTSIDE_TEMP in sensors_to_load):
@ -65,9 +65,9 @@ async def async_setup_entry(
async_add_entities(sensors)
class WeatherSensor(
CoordinatorEntity[WeatherDataUpdateCoordinator], RestoreSensor, SensorEntity
):
class WeatherSensor( # pyright: ignore[reportIncompatibleVariableOverride]
CoordinatorEntity[WeatherDataUpdateCoordinator], SensorEntity
): # pyright: ignore[reportIncompatibleVariableOverride]
"""Implementation of Weather Sensor entity."""
_attr_has_entity_name = True
@ -94,12 +94,6 @@ class WeatherSensor(
self.coordinator.async_add_listener(self._handle_coordinator_update)
# prev_state_data = await self.async_get_last_sensor_data()
# prev_state = await self.async_get_last_state()
# if not prev_state:
# return
# self._data = prev_state_data.native_value
@callback
def _handle_coordinator_update(self) -> None:
"""Handle updated data from the coordinator."""
@ -110,30 +104,30 @@ class WeatherSensor(
self.async_write_ha_state()
@property
def native_value(self) -> str | int | float | None:
def native_value(self): # pyright: ignore[reportIncompatibleVariableOverride]
"""Return value of entity."""
_wslink = self.coordinator.config.options.get(WSLINK)
if self.coordinator.data and (WIND_AZIMUT in self.entity_description.key):
return self.entity_description.value_fn(self.coordinator.data.get(WIND_DIR))
return self.entity_description.value_fn(self.coordinator.data.get(WIND_DIR)) # pyright: ignore[ reportAttributeAccessIssue]
if (
self.coordinator.data
and (HEAT_INDEX in self.entity_description.key)
and not _wslink
):
return self.entity_description.value_fn(heat_index(self.coordinator.data))
return self.entity_description.value_fn(heat_index(self.coordinator.data)) # pyright: ignore[ reportAttributeAccessIssue]
if (
self.coordinator.data
and (CHILL_INDEX in self.entity_description.key)
and not _wslink
):
return self.entity_description.value_fn(chill_index(self.coordinator.data))
return self.entity_description.value_fn(chill_index(self.coordinator.data)) # pyright: ignore[ reportAttributeAccessIssue]
return (
None if self._data == "" else self.entity_description.value_fn(self._data)
None if self._data == "" else self.entity_description.value_fn(self._data) # pyright: ignore[ reportAttributeAccessIssue]
)
@property
@ -142,19 +136,20 @@ class WeatherSensor(
return generate_entity_id("sensor.{}", self.entity_description.key)
@property
def icon(self) -> str | None:
def icon(self) -> str | None: # pyright: ignore[reportIncompatibleVariableOverride]
"""Return the dynamic icon for battery representation."""
if self.entity_description.key in BATTERY_LIST:
try:
return battery_level_to_icon(self.native_value)
except Exception:
return "mdi:battery-unknown"
if self.native_value:
battery_level = battery_level_to_text(self.native_value)
return battery_level_to_icon(battery_level)
return battery_level_to_icon(UnitOfBat.UNKNOWN)
return self.entity_description.icon
@property
def device_info(self) -> DeviceInfo:
def device_info(self) -> DeviceInfo: # pyright: ignore[reportIncompatibleVariableOverride]
"""Device info."""
return DeviceInfo(
connections=set(),

View File

@ -17,14 +17,11 @@ from homeassistant.const import (
from .const import (
BARO_PRESSURE,
CH2_BATTERY,
CH2_HUMIDITY,
CH2_TEMP,
CH2_BATTERY,
INDOOR_BATTERY,
CH3_HUMIDITY,
CH3_TEMP,
CH4_HUMIDITY,
CH4_TEMP,
CHILL_INDEX,
DAILY_RAIN,
DEW_POINT,
@ -33,7 +30,6 @@ from .const import (
INDOOR_BATTERY,
INDOOR_HUMIDITY,
INDOOR_TEMP,
INDOOR_BATTERY,
MONTHLY_RAIN,
OUTSIDE_BATTERY,
OUTSIDE_HUMIDITY,
@ -41,6 +37,7 @@ from .const import (
RAIN,
SOLAR_RADIATION,
UV,
WBGT_TEMP,
WEEKLY_RAIN,
WIND_AZIMUT,
WIND_DIR,
@ -48,10 +45,9 @@ from .const import (
WIND_SPEED,
YEARLY_RAIN,
UnitOfDir,
WBGT_TEMP,
)
from .sensors_common import WeatherSensorEntityDescription
from .utils import battery_level_to_icon, battery_level_to_text, wind_dir_to_text
from .utils import wind_dir_to_text
SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
WeatherSensorEntityDescription(
@ -258,7 +254,7 @@ SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
suggested_unit_of_measurement=UnitOfTemperature.CELSIUS,
icon="mdi:weather-sunny",
translation_key=CH3_TEMP,
value_fn=lambda data: cast(float, data),
value_fn=lambda data: cast("float", data),
),
WeatherSensorEntityDescription(
key=CH3_HUMIDITY,
@ -267,7 +263,7 @@ SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
device_class=SensorDeviceClass.HUMIDITY,
icon="mdi:weather-sunny",
translation_key=CH3_HUMIDITY,
value_fn=lambda data: cast(int, data),
value_fn=lambda data: cast("int", data),
),
# WeatherSensorEntityDescription(
# key=CH4_TEMP,
@ -315,21 +311,21 @@ SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
translation_key=OUTSIDE_BATTERY,
icon="mdi:battery-unknown",
device_class=SensorDeviceClass.ENUM,
value_fn=lambda data: battery_level_to_text(data),
value_fn=lambda data: (data),
),
WeatherSensorEntityDescription(
key=CH2_BATTERY,
translation_key=CH2_BATTERY,
icon="mdi:battery-unknown",
device_class=SensorDeviceClass.ENUM,
value_fn=lambda data: battery_level_to_text(data),
value_fn=lambda data: (data),
),
WeatherSensorEntityDescription(
key=INDOOR_BATTERY,
translation_key=INDOOR_BATTERY,
icon="mdi:battery-unknown",
device_class=SensorDeviceClass.ENUM,
value_fn=lambda data: battery_level_to_text(data),
value_fn=lambda data: (data),
),
WeatherSensorEntityDescription(
key=WBGT_TEMP,

View File

@ -5,7 +5,6 @@
"valid_credentials_key": "Provide valid API KEY.",
"valid_credentials_match": "API ID and API KEY should not be the same."
},
"step": {
"user": {
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
@ -25,7 +24,6 @@
}
}
},
"options": {
"error": {
"valid_credentials_api": "Provide valid API ID.",
@ -33,7 +31,6 @@
"valid_credentials_match": "API ID and API KEY should not be the same.",
"windy_key_required": "Windy API key is required if you want to enable this function."
},
"step": {
"init": {
"title": "Configure SWS12500 Integration",
@ -43,7 +40,6 @@
"windy": "Windy configuration"
}
},
"basic": {
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
"title": "Configure credentials",
@ -60,7 +56,6 @@
"WSLINK": "Enable WSLink API if the station is set to send data via WSLink."
}
},
"windy": {
"description": "Resend weather data to your Windy stations.",
"title": "Configure Windy",
@ -74,6 +69,24 @@
"windy_logger_checkbox": "Enable only if you want to send debuging data to the developer."
}
},
"pocasi": {
"description": "Resend data to Pocasi Meteo CZ",
"title": "Configure Pocasi Meteo CZ",
"data": {
"POCASI_CZ_API_ID": "ID from your Pocasi Meteo APP",
"POCASI_CZ_API_KEY": "Key from your Pocasi Meteo APP",
"POCASI_CZ_SEND_INTERVAL": "Resend interval in seconds",
"pocasi_enabled_checkbox": "Enable resending data to Pocasi Meteo",
"pocasi_logger_checkbox": "Log data and responses"
},
"data_description": {
"POCASI_CZ_API_ID": "You can obtain your ID in Pocasi Meteo App",
"POCASI_CZ_API_KEY": "You can obtain your KEY in Pocasi Meteo App",
"POCASI_CZ_SEND_INTERVAL": "Resend interval in seconds (minimum 12s, default 30s)",
"pocasi_enabled_checkbox": "Enables resending data to Pocasi Meteo",
"pocasi_logger_checkbox": "Enable only if you want to send debbug data to the developer"
}
},
"migration": {
"title": "Statistic migration.",
"description": "For the correct functioning of long-term statistics, it is necessary to migrate the sensor unit in the long-term statistics. The original unit of long-term statistics for daily precipitation was in mm/d, however, the station only sends data in mm without time differentiation.\n\n The sensor to be migrated is for daily precipitation. If the correct value is already in the list for the daily precipitation sensor (mm), then the migration is already complete.\n\n Migration result for the sensor: {migration_status}, a total of {migration_count} rows converted.",
@ -88,30 +101,71 @@
}
}
},
"entity": {
"sensor": {
"indoor_temp": { "name": "Indoor temperature" },
"indoor_humidity": { "name": "Indoor humidity" },
"outside_temp": { "name": "Outside Temperature" },
"outside_humidity": { "name": "Outside humidity" },
"uv": { "name": "UV index" },
"baro_pressure": { "name": "Barometric pressure" },
"dew_point": { "name": "Dew point" },
"wind_speed": { "name": "Wind speed" },
"wind_dir": { "name": "Wind direction" },
"wind_gust": { "name": "Wind gust" },
"rain": { "name": "Rain" },
"daily_rain": { "name": "Daily precipitation" },
"solar_radiation": { "name": "Solar irradiance" },
"ch2_temp": { "name": "Channel 2 temperature" },
"ch2_humidity": { "name": "Channel 2 humidity" },
"ch3_temp": { "name": "Channel 3 temperature" },
"ch3_humidity": { "name": "Channel 3 humidity" },
"ch4_temp": { "name": "Channel 4 temperature" },
"ch4_humidity": { "name": "Channel 4 humidity" },
"heat_index": { "name": "Apparent temperature" },
"chill_index": { "name": "Wind chill" },
"indoor_temp": {
"name": "Indoor temperature"
},
"indoor_humidity": {
"name": "Indoor humidity"
},
"outside_temp": {
"name": "Outside Temperature"
},
"outside_humidity": {
"name": "Outside humidity"
},
"uv": {
"name": "UV index"
},
"baro_pressure": {
"name": "Barometric pressure"
},
"dew_point": {
"name": "Dew point"
},
"wind_speed": {
"name": "Wind speed"
},
"wind_dir": {
"name": "Wind direction"
},
"wind_gust": {
"name": "Wind gust"
},
"rain": {
"name": "Rain"
},
"daily_rain": {
"name": "Daily precipitation"
},
"solar_radiation": {
"name": "Solar irradiance"
},
"ch2_temp": {
"name": "Channel 2 temperature"
},
"ch2_humidity": {
"name": "Channel 2 humidity"
},
"ch3_temp": {
"name": "Channel 3 temperature"
},
"ch3_humidity": {
"name": "Channel 3 humidity"
},
"ch4_temp": {
"name": "Channel 4 temperature"
},
"ch4_humidity": {
"name": "Channel 4 humidity"
},
"heat_index": {
"name": "Apparent temperature"
},
"chill_index": {
"name": "Wind chill"
},
"wind_azimut": {
"name": "Bearing",
"state": {

View File

@ -24,15 +24,16 @@
}
}
},
"options": {
"error": {
"valid_credentials_api": "Vyplňte platné API ID",
"valid_credentials_key": "Vyplňte platný API KEY",
"valid_credentials_match": "API ID a API KEY nesmějí být stejné!",
"windy_key_required": "Je vyžadován Windy API key, pokud chcete aktivovat přeposílání dat na Windy"
"windy_key_required": "Je vyžadován Windy API key, pokud chcete aktivovat přeposílání dat na Windy",
"pocasi_id_required": "Je vyžadován Počasí ID, pokud chcete aktivovat přeposílání dat na Počasí Meteo CZ",
"pocasi_key_required": "Klíč k účtu Počasí Meteo je povinný.",
"pocasi_send_minimum": "Minimální interval pro přeposílání je 12 sekund."
},
"step": {
"init": {
"title": "Nastavení integrace SWS12500",
@ -40,10 +41,10 @@
"menu_options": {
"basic": "Základní - přístupové údaje (přihlášení)",
"windy": "Nastavení pro přeposílání dat na Windy",
"pocasi": "Nastavení pro přeposlání dat na Počasí Meteo CZ",
"migration": "Migrace statistiky senzoru"
}
},
"basic": {
"description": "Zadejte API ID a API KEY, aby meteostanice mohla komunikovat s HomeAssistantem",
"title": "Nastavení přihlášení",
@ -60,7 +61,6 @@
"wslink": "WSLink API zapněte, pokud je stanice nastavena na zasílání dat přes WSLink."
}
},
"windy": {
"description": "Přeposílání dat z metostanice na Windy",
"title": "Konfigurace Windy",
@ -70,10 +70,28 @@
"windy_logger_checkbox": "Logovat data a odpovědi z Windy"
},
"data_description": {
"WINDY_API_KEY": "Klíč API KEY získaný z https://https://api.windy.com/keys",
"WINDY_API_KEY": "Klíč API KEY získaný z https://api.windy.com/keys",
"windy_logger_checkbox": "Zapnout pouze v případě, že chcete poslat ladící informace vývojáři."
}
},
"pocasi": {
"description": "Přeposílání dat do aplikace Počasí Meteo",
"title": "Konfigurace Počasí Meteo",
"data": {
"POCASI_CZ_API_ID": "ID účtu na Počasí Meteo",
"POCASI_CZ_API_KEY": "Klíč (Key) k účtu Počasí Meteo",
"POCASI_CZ_SEND_INTERVAL": "Interval v sekundách",
"pocasi_enabled_chcekbox": "Povolit přeposílání dat na server Počasí Meteo",
"pocasi_logger_checkbox": "Logovat data a odpovědi z Počasí Meteo"
},
"data_description": {
"POCASI_API_ID": "ID získáte ve své aplikaci Počasí Meteo",
"POCASI_API_KEY": "Klíč (Key) získáte ve své aplikaci Počasí Meteo",
"POCASI_SEND_INTERVAL": "Interval v jakém se mají data na server přeposílat (minimum 12s, defaultně 30s)",
"pocasi_enabled_checkbox": "Zapne přeposílání data na server Počasí Meteo",
"pocasi_logger_checkbox": "Zapnout pouze v případě, že chcete zaslat ladící informace vývojáři."
}
},
"migration": {
"title": "Migrace statistiky senzoru.",
"description": "Pro správnou funkci dlouhodobé statistiky je nutné provést migraci jednotky senzoru v dlouhodobé statistice. Původní jednotka dlouhodobé statistiky pro denní úhrn srážek byla v mm/d, nicméně stanice zasílá pouze data v mm bez časového rozlišení.\n\n Senzor, který má být migrován je pro denní úhrn srážek. Pokud je v seznamu již správná hodnota u senzoru pro denní úhrn (mm), pak je již migrace hotová.\n\n Výsledek migrace pro senzor: {migration_status}, přepvedeno celkem {migration_count} řádků.",
@ -88,35 +106,86 @@
}
}
},
"entity": {
"sensor": {
"indoor_temp": { "name": "Vnitřní teplota" },
"indoor_humidity": { "name": "Vnitřní vlhkost vzduchu" },
"outside_temp": { "name": "Venkovní teplota" },
"outside_humidity": { "name": "Venkovní vlhkost vzduchu" },
"uv": { "name": "UV index" },
"baro_pressure": { "name": "Tlak vzduchu" },
"dew_point": { "name": "Rosný bod" },
"wind_speed": { "name": "Rychlost větru" },
"wind_dir": { "name": "Směr větru" },
"wind_gust": { "name": "Poryvy větru" },
"rain": { "name": "Srážky" },
"daily_rain": { "name": "Denní úhrn srážek" },
"solar_radiation": { "name": "Sluneční osvit" },
"ch2_temp": { "name": "Teplota senzoru 2" },
"ch2_humidity": { "name": "Vlhkost sensoru 2" },
"ch3_temp": { "name": "Teplota senzoru 3" },
"ch3_humidity": { "name": "Vlhkost sensoru 3" },
"ch4_temp": { "name": "Teplota senzoru 4" },
"ch4_humidity": { "name": "Vlhkost sensoru 4" },
"heat_index": { "name": "Tepelný index" },
"chill_index": { "name": "Pocitová teplota" },
"hourly_rain": { "name": "Hodinový úhrn srážek" },
"weekly_rain": { "name": "Týdenní úhrn srážek" },
"monthly_rain": { "name": "Měsíční úhrn srážek" },
"yearly_rain": { "name": "Roční úhrn srážek" },
"wbgt_temp": { "name": "WBGT index" },
"indoor_temp": {
"name": "Vnitřní teplota"
},
"indoor_humidity": {
"name": "Vnitřní vlhkost vzduchu"
},
"outside_temp": {
"name": "Venkovní teplota"
},
"outside_humidity": {
"name": "Venkovní vlhkost vzduchu"
},
"uv": {
"name": "UV index"
},
"baro_pressure": {
"name": "Tlak vzduchu"
},
"dew_point": {
"name": "Rosný bod"
},
"wind_speed": {
"name": "Rychlost větru"
},
"wind_dir": {
"name": "Směr větru"
},
"wind_gust": {
"name": "Poryvy větru"
},
"rain": {
"name": "Srážky"
},
"daily_rain": {
"name": "Denní úhrn srážek"
},
"solar_radiation": {
"name": "Sluneční osvit"
},
"ch2_temp": {
"name": "Teplota senzoru 2"
},
"ch2_humidity": {
"name": "Vlhkost sensoru 2"
},
"ch3_temp": {
"name": "Teplota senzoru 3"
},
"ch3_humidity": {
"name": "Vlhkost sensoru 3"
},
"ch4_temp": {
"name": "Teplota senzoru 4"
},
"ch4_humidity": {
"name": "Vlhkost sensoru 4"
},
"heat_index": {
"name": "Tepelný index"
},
"chill_index": {
"name": "Pocitová teplota"
},
"hourly_rain": {
"name": "Hodinový úhrn srážek"
},
"weekly_rain": {
"name": "Týdenní úhrn srážek"
},
"monthly_rain": {
"name": "Měsíční úhrn srážek"
},
"yearly_rain": {
"name": "Roční úhrn srážek"
},
"wbgt_temp": {
"name": "WBGT index"
},
"wind_azimut": {
"name": "Azimut",
"state": {

View File

@ -5,7 +5,6 @@
"valid_credentials_key": "Provide valid API KEY.",
"valid_credentials_match": "API ID and API KEY should not be the same."
},
"step": {
"user": {
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
@ -25,7 +24,6 @@
}
}
},
"options": {
"error": {
"valid_credentials_api": "Provide valid API ID.",
@ -33,7 +31,6 @@
"valid_credentials_match": "API ID and API KEY should not be the same.",
"windy_key_required": "Windy API key is required if you want to enable this function."
},
"step": {
"init": {
"title": "Configure SWS12500 Integration",
@ -43,7 +40,6 @@
"windy": "Windy configuration"
}
},
"basic": {
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
"title": "Configure credentials",
@ -60,7 +56,6 @@
"WSLINK": "Enable WSLink API if the station is set to send data via WSLink."
}
},
"windy": {
"description": "Resend weather data to your Windy stations.",
"title": "Configure Windy",
@ -74,6 +69,24 @@
"windy_logger_checkbox": "Enable only if you want to send debuging data to the developer."
}
},
"pocasi": {
"description": "Resend data to Pocasi Meteo CZ",
"title": "Configure Pocasi Meteo CZ",
"data": {
"POCASI_CZ_API_ID": "ID from your Pocasi Meteo APP",
"POCASI_CZ_API_KEY": "Key from your Pocasi Meteo APP",
"POCASI_CZ_SEND_INTERVAL": "Resend interval in seconds",
"pocasi_enabled_checkbox": "Enable resending data to Pocasi Meteo",
"pocasi_logger_checkbox": "Log data and responses"
},
"data_description": {
"POCASI_CZ_API_ID": "You can obtain your ID in Pocasi Meteo App",
"POCASI_CZ_API_KEY": "You can obtain your KEY in Pocasi Meteo App",
"POCASI_CZ_SEND_INTERVAL": "Resend interval in seconds (minimum 12s, default 30s)",
"pocasi_enabled_checkbox": "Enables resending data to Pocasi Meteo",
"pocasi_logger_checkbox": "Enable only if you want to send debbug data to the developer"
}
},
"migration": {
"title": "Statistic migration.",
"description": "For the correct functioning of long-term statistics, it is necessary to migrate the sensor unit in the long-term statistics. The original unit of long-term statistics for daily precipitation was in mm/d, however, the station only sends data in mm without time differentiation.\n\n The sensor to be migrated is for daily precipitation. If the correct value is already in the list for the daily precipitation sensor (mm), then the migration is already complete.\n\n Migration result for the sensor: {migration_status}, a total of {migration_count} rows converted.",
@ -88,35 +101,86 @@
}
}
},
"entity": {
"sensor": {
"indoor_temp": { "name": "Indoor temperature" },
"indoor_humidity": { "name": "Indoor humidity" },
"outside_temp": { "name": "Outside Temperature" },
"outside_humidity": { "name": "Outside humidity" },
"uv": { "name": "UV index" },
"baro_pressure": { "name": "Barometric pressure" },
"dew_point": { "name": "Dew point" },
"wind_speed": { "name": "Wind speed" },
"wind_dir": { "name": "Wind direction" },
"wind_gust": { "name": "Wind gust" },
"rain": { "name": "Rain" },
"daily_rain": { "name": "Daily precipitation" },
"solar_radiation": { "name": "Solar irradiance" },
"ch2_temp": { "name": "Channel 2 temperature" },
"ch2_humidity": { "name": "Channel 2 humidity" },
"ch3_temp": { "name": "Channel 3 temperature" },
"ch3_humidity": { "name": "Channel 3 humidity" },
"ch4_temp": { "name": "Channel 4 temperature" },
"ch4_humidity": { "name": "Channel 4 humidity" },
"heat_index": { "name": "Apparent temperature" },
"chill_index": { "name": "Wind chill" },
"hourly_rain": { "name": "Hourly precipitation" },
"weekly_rain": { "name": "Weekly precipitation" },
"monthly_rain": { "name": "Monthly precipitation" },
"yearly_rain": { "name": "Yearly precipitation" },
"wbgt_index": { "name": "WBGT index" },
"indoor_temp": {
"name": "Indoor temperature"
},
"indoor_humidity": {
"name": "Indoor humidity"
},
"outside_temp": {
"name": "Outside Temperature"
},
"outside_humidity": {
"name": "Outside humidity"
},
"uv": {
"name": "UV index"
},
"baro_pressure": {
"name": "Barometric pressure"
},
"dew_point": {
"name": "Dew point"
},
"wind_speed": {
"name": "Wind speed"
},
"wind_dir": {
"name": "Wind direction"
},
"wind_gust": {
"name": "Wind gust"
},
"rain": {
"name": "Rain"
},
"daily_rain": {
"name": "Daily precipitation"
},
"solar_radiation": {
"name": "Solar irradiance"
},
"ch2_temp": {
"name": "Channel 2 temperature"
},
"ch2_humidity": {
"name": "Channel 2 humidity"
},
"ch3_temp": {
"name": "Channel 3 temperature"
},
"ch3_humidity": {
"name": "Channel 3 humidity"
},
"ch4_temp": {
"name": "Channel 4 temperature"
},
"ch4_humidity": {
"name": "Channel 4 humidity"
},
"heat_index": {
"name": "Apparent temperature"
},
"chill_index": {
"name": "Wind chill"
},
"hourly_rain": {
"name": "Hourly precipitation"
},
"weekly_rain": {
"name": "Weekly precipitation"
},
"monthly_rain": {
"name": "Monthly precipitation"
},
"yearly_rain": {
"name": "Yearly precipitation"
},
"wbgt_index": {
"name": "WBGT index"
},
"wind_azimut": {
"name": "Bearing",
"state": {

View File

@ -10,17 +10,11 @@ import numpy as np
from homeassistant.components import persistent_notification
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
UnitOfPrecipitationDepth,
UnitOfTemperature,
UnitOfVolumetricFlux,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.translation import async_get_translations
from .const import (
AZIMUT,
BATTERY_LEVEL,
DATABASE_PATH,
DEV_DBG,
OUTSIDE_HUMIDITY,
@ -29,8 +23,8 @@ from .const import (
REMAP_WSLINK_ITEMS,
SENSORS_TO_LOAD,
WIND_SPEED,
UnitOfDir,
UnitOfBat,
UnitOfDir,
)
_LOGGER = logging.getLogger(__name__)
@ -55,7 +49,7 @@ async def translations(
)
if localize_key in _translations:
return _translations[localize_key]
return None
return ""
async def translated_notification(
@ -67,7 +61,7 @@ async def translated_notification(
*,
key: str = "message",
category: str = "notify",
) -> str:
):
"""Translate notification."""
localize_key = f"component.{translation_domain}.{category}.{translation_key}.{key}"
@ -98,7 +92,7 @@ async def translated_notification(
async def update_options(
hass: HomeAssistant, entry: ConfigEntry, update_key, update_value
) -> None:
) -> bool:
"""Update config.options entry."""
conf = {**entry.options}
conf[update_key] = update_value
@ -153,7 +147,7 @@ def check_disabled(
Returns list of found sensors or None
"""
log: bool = config_entry.options.get(DEV_DBG)
log: bool = config_entry.options.get(DEV_DBG, False)
entityFound: bool = False
_loaded_sensors = loaded_sensors(config_entry)
missing_sensors: list = []
@ -189,10 +183,15 @@ def battery_level_to_text(battery: int) -> UnitOfBat:
Returns UnitOfBat
"""
return {
level_map: dict[int, UnitOfBat] = {
0: UnitOfBat.LOW,
1: UnitOfBat.NORMAL,
}.get(int(battery) if battery is not None else None, UnitOfBat.UNKNOWN)
}
if battery is None:
return UnitOfBat.UNKNOWN
return level_map.get(int(battery), UnitOfBat.UNKNOWN)
def battery_level_to_icon(battery: UnitOfBat) -> str:
@ -219,7 +218,7 @@ def celsius_to_fahrenheit(celsius: float) -> float:
return celsius * 9.0 / 5.0 + 32
def heat_index(data: Any, convert: bool = False) -> UnitOfTemperature:
def heat_index(data: Any, convert: bool = False) -> float:
"""Calculate heat index from temperature.
data: dict with temperature and humidity
@ -257,7 +256,7 @@ def heat_index(data: Any, convert: bool = False) -> UnitOfTemperature:
return simple
def chill_index(data: Any, convert: bool = False) -> UnitOfTemperature:
def chill_index(data: Any, convert: bool = False) -> float:
"""Calculate wind chill index from temperature and wind speed.
data: dict with temperature and wind speed
@ -286,7 +285,7 @@ def chill_index(data: Any, convert: bool = False) -> UnitOfTemperature:
def long_term_units_in_statistics_meta():
"""Get units in long term statitstics."""
sensor_units = []
if not Path(DATABASE_PATH).exists():
_LOGGER.error("Database file not found: %s", DATABASE_PATH)
return False
@ -314,7 +313,7 @@ def long_term_units_in_statistics_meta():
return sensor_units
async def migrate_data(hass: HomeAssistant, sensor_id: str | None = None) -> bool:
async def migrate_data(hass: HomeAssistant, sensor_id: str | None = None) -> int | bool:
"""Migrate data from mm/d to mm."""
_LOGGER.debug("Sensor %s is required for data migration", sensor_id)

View File

@ -3,6 +3,8 @@
from datetime import datetime, timedelta
import logging
from aiohttp.client_exceptions import ClientError
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -106,7 +108,7 @@ class WindyPush:
if self.next_update > datetime.now():
return False
purged_data = dict(data)
purged_data = data.copy()
for purge in PURGE_DATA:
if purge in purged_data:
@ -138,20 +140,20 @@ class WindyPush:
_LOGGER.critical(WINDY_INVALID_KEY)
text_for_test = WINDY_INVALID_KEY
update_options(self.hass, self.config, WINDY_ENABLED, False)
await update_options(self.hass, self.config, WINDY_ENABLED, False)
except WindySuccess:
if self.log:
_LOGGER.info(WINDY_SUCCESS)
text_for_test = WINDY_SUCCESS
except session.ClientError as ex:
except ClientError as ex:
_LOGGER.critical("Invalid response from Windy: %s", str(ex))
self.invalid_response_count += 1
if self.invalid_response_count > 3:
_LOGGER.critical(WINDY_UNEXPECTED)
text_for_test = WINDY_UNEXPECTED
update_options(self.hass, self.config, WINDY_ENABLED, False)
await update_options(self.hass, self.config, WINDY_ENABLED, False)
self.last_update = datetime.now()
self.next_update = self.last_update + timed(minutes=5)