Compare commits
No commits in common. "6edaec73d851df21946ae4f29cfd215c8b9f9251" and "006376fc492251fb68aaed8934427cf1565ace6e" have entirely different histories.
6edaec73d8
...
006376fc49
10
README.md
10
README.md
|
|
@ -102,16 +102,6 @@ As soon as the integration is added into Home Assistant it will listen for incom
|
||||||
|
|
||||||
- You are done.
|
- 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
|
## WSLink notes
|
||||||
|
|
||||||
While your station is using WSLink you have to have Home Assistant in SSL mode or behind SSL proxy server.
|
While your station is using WSLink you have to have Home Assistant in SSL mode or behind SSL proxy server.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import aiohttp.web
|
import aiohttp
|
||||||
from aiohttp.web_exceptions import HTTPUnauthorized
|
from aiohttp.web_exceptions import HTTPUnauthorized
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
|
@ -17,13 +17,11 @@ from .const import (
|
||||||
DEFAULT_URL,
|
DEFAULT_URL,
|
||||||
DEV_DBG,
|
DEV_DBG,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
POCASI_CZ_ENABLED,
|
|
||||||
SENSORS_TO_LOAD,
|
SENSORS_TO_LOAD,
|
||||||
WINDY_ENABLED,
|
WINDY_ENABLED,
|
||||||
WSLINK,
|
WSLINK,
|
||||||
WSLINK_URL,
|
WSLINK_URL,
|
||||||
)
|
)
|
||||||
from .pocasti_cz import PocasiPush
|
|
||||||
from .routes import Routes, unregistred
|
from .routes import Routes, unregistred
|
||||||
from .utils import (
|
from .utils import (
|
||||||
anonymize,
|
anonymize,
|
||||||
|
|
@ -53,7 +51,6 @@ class WeatherDataUpdateCoordinator(DataUpdateCoordinator):
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self.config = config
|
self.config = config
|
||||||
self.windy = WindyPush(hass, config)
|
self.windy = WindyPush(hass, config)
|
||||||
self.pocasi: PocasiPush = PocasiPush(hass, config)
|
|
||||||
super().__init__(hass, _LOGGER, name=DOMAIN)
|
super().__init__(hass, _LOGGER, name=DOMAIN)
|
||||||
|
|
||||||
async def recieved_data(self, webdata):
|
async def recieved_data(self, webdata):
|
||||||
|
|
@ -88,9 +85,6 @@ class WeatherDataUpdateCoordinator(DataUpdateCoordinator):
|
||||||
if self.config_entry.options.get(WINDY_ENABLED):
|
if self.config_entry.options.get(WINDY_ENABLED):
|
||||||
response = await self.windy.push_data_to_windy(data)
|
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 = (
|
remaped_items = (
|
||||||
remap_wslink_items(data)
|
remap_wslink_items(data)
|
||||||
if self.config_entry.options.get(WSLINK)
|
if self.config_entry.options.get(WSLINK)
|
||||||
|
|
@ -140,11 +134,11 @@ def register_path(
|
||||||
|
|
||||||
hass_data = hass.data.setdefault(DOMAIN, {})
|
hass_data = hass.data.setdefault(DOMAIN, {})
|
||||||
debug = config.options.get(DEV_DBG)
|
debug = config.options.get(DEV_DBG)
|
||||||
_wslink = config.options.get(WSLINK, False)
|
_wslink = config.options.get(WSLINK)
|
||||||
|
|
||||||
routes: Routes = hass_data.get("routes", Routes())
|
routes: Routes = hass_data.get("routes") if "routes" in hass_data else None
|
||||||
|
|
||||||
if not routes.routes:
|
if routes is None:
|
||||||
routes = Routes()
|
routes = Routes()
|
||||||
_LOGGER.info("Routes not found, creating new routes")
|
_LOGGER.info("Routes not found, creating new routes")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from typing import Any
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
from homeassistant.config_entries import ConfigFlow, OptionsFlow
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
|
|
||||||
|
|
@ -14,12 +14,6 @@ from .const import (
|
||||||
DEV_DBG,
|
DEV_DBG,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
INVALID_CREDENTIALS,
|
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,
|
SENSORS_TO_LOAD,
|
||||||
WINDY_API_KEY,
|
WINDY_API_KEY,
|
||||||
WINDY_ENABLED,
|
WINDY_ENABLED,
|
||||||
|
|
@ -49,8 +43,6 @@ class ConfigOptionsFlowHandler(OptionsFlow):
|
||||||
self.user_data_schema = {}
|
self.user_data_schema = {}
|
||||||
self.sensors: dict[str, Any] = {}
|
self.sensors: dict[str, Any] = {}
|
||||||
self.migrate_schema = {}
|
self.migrate_schema = {}
|
||||||
self.pocasi_cz: dict[str, Any] = {}
|
|
||||||
self.pocasi_cz_schema = {}
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def config_entry(self):
|
def config_entry(self):
|
||||||
|
|
@ -59,7 +51,7 @@ class ConfigOptionsFlowHandler(OptionsFlow):
|
||||||
async def _get_entry_data(self):
|
async def _get_entry_data(self):
|
||||||
"""Get entry data."""
|
"""Get entry data."""
|
||||||
|
|
||||||
self.user_data = {
|
self.user_data: dict[str, Any] = {
|
||||||
API_ID: self.config_entry.options.get(API_ID),
|
API_ID: self.config_entry.options.get(API_ID),
|
||||||
API_KEY: self.config_entry.options.get(API_KEY),
|
API_KEY: self.config_entry.options.get(API_KEY),
|
||||||
WSLINK: self.config_entry.options.get(WSLINK, False),
|
WSLINK: self.config_entry.options.get(WSLINK, False),
|
||||||
|
|
@ -73,7 +65,7 @@ class ConfigOptionsFlowHandler(OptionsFlow):
|
||||||
vol.Optional(DEV_DBG, default=self.user_data.get(DEV_DBG, False)): bool,
|
vol.Optional(DEV_DBG, default=self.user_data.get(DEV_DBG, False)): bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
self.sensors = {
|
self.sensors: dict[str, Any] = {
|
||||||
SENSORS_TO_LOAD: (
|
SENSORS_TO_LOAD: (
|
||||||
self.config_entry.options.get(SENSORS_TO_LOAD)
|
self.config_entry.options.get(SENSORS_TO_LOAD)
|
||||||
if isinstance(self.config_entry.options.get(SENSORS_TO_LOAD), list)
|
if isinstance(self.config_entry.options.get(SENSORS_TO_LOAD), list)
|
||||||
|
|
@ -81,7 +73,7 @@ class ConfigOptionsFlowHandler(OptionsFlow):
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.windy_data = {
|
self.windy_data: dict[str, Any] = {
|
||||||
WINDY_API_KEY: self.config_entry.options.get(WINDY_API_KEY),
|
WINDY_API_KEY: self.config_entry.options.get(WINDY_API_KEY),
|
||||||
WINDY_ENABLED: self.config_entry.options.get(WINDY_ENABLED, False),
|
WINDY_ENABLED: self.config_entry.options.get(WINDY_ENABLED, False),
|
||||||
WINDY_LOGGER_ENABLED: self.config_entry.options.get(
|
WINDY_LOGGER_ENABLED: self.config_entry.options.get(
|
||||||
|
|
@ -98,46 +90,13 @@ class ConfigOptionsFlowHandler(OptionsFlow):
|
||||||
vol.Optional(
|
vol.Optional(
|
||||||
WINDY_LOGGER_ENABLED,
|
WINDY_LOGGER_ENABLED,
|
||||||
default=self.windy_data[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):
|
async def async_step_init(self, user_input=None):
|
||||||
"""Manage the options - show menu first."""
|
"""Manage the options - show menu first."""
|
||||||
return self.async_show_menu(
|
return self.async_show_menu(step_id="init", menu_options=["basic", "windy"])
|
||||||
step_id="init", menu_options=["basic", "windy", "pocasi"]
|
|
||||||
)
|
|
||||||
|
|
||||||
async def async_step_basic(self, user_input=None):
|
async def async_step_basic(self, user_input=None):
|
||||||
"""Manage basic options - credentials."""
|
"""Manage basic options - credentials."""
|
||||||
|
|
@ -165,9 +124,6 @@ class ConfigOptionsFlowHandler(OptionsFlow):
|
||||||
# retain sensors
|
# retain sensors
|
||||||
user_input.update(self.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)
|
return self.async_create_entry(title=DOMAIN, data=user_input)
|
||||||
|
|
||||||
self.user_data = user_input
|
self.user_data = user_input
|
||||||
|
|
@ -206,54 +162,10 @@ class ConfigOptionsFlowHandler(OptionsFlow):
|
||||||
# retain senors
|
# retain senors
|
||||||
user_input.update(self.sensors)
|
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)
|
return self.async_create_entry(title=DOMAIN, data=user_input)
|
||||||
|
|
||||||
|
|
||||||
class ConfigFlowHandler(ConfigFlow, domain=DOMAIN):
|
class ConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Sencor SWS 12500 Weather Station."""
|
"""Handle a config flow for Sencor SWS 12500 Weather Station."""
|
||||||
|
|
||||||
data_schema = {
|
data_schema = {
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,6 @@ WSLINK_URL = "/data/upload.php"
|
||||||
WINDY_URL = "https://stations.windy.com/pws/update/"
|
WINDY_URL = "https://stations.windy.com/pws/update/"
|
||||||
DATABASE_PATH = "/config/home-assistant_v2.db"
|
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"
|
ICON = "mdi:weather"
|
||||||
|
|
||||||
API_KEY = "API_KEY"
|
API_KEY = "API_KEY"
|
||||||
|
|
@ -23,19 +20,6 @@ SENSOR_TO_MIGRATE: Final = "sensor_to_migrate"
|
||||||
DEV_DBG: Final = "dev_debug_checkbox"
|
DEV_DBG: Final = "dev_debug_checkbox"
|
||||||
WSLINK: Final = "wslink"
|
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_API_KEY = "WINDY_API_KEY"
|
||||||
WINDY_ENABLED: Final = "windy_enabled_checkbox"
|
WINDY_ENABLED: Final = "windy_enabled_checkbox"
|
||||||
WINDY_LOGGER_ENABLED: Final = "windy_logger_checkbox"
|
WINDY_LOGGER_ENABLED: Final = "windy_logger_checkbox"
|
||||||
|
|
@ -73,13 +57,6 @@ PURGE_DATA: Final = [
|
||||||
"dailyrainin",
|
"dailyrainin",
|
||||||
]
|
]
|
||||||
|
|
||||||
PURGE_DATA_POCAS: Final = [
|
|
||||||
"ID",
|
|
||||||
"PASSWORD",
|
|
||||||
"action",
|
|
||||||
"rtfreq",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
BARO_PRESSURE: Final = "baro_pressure"
|
BARO_PRESSURE: Final = "baro_pressure"
|
||||||
OUTSIDE_TEMP: Final = "outside_temp"
|
OUTSIDE_TEMP: Final = "outside_temp"
|
||||||
|
|
|
||||||
|
|
@ -1,143 +0,0 @@
|
||||||
"""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
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
"""Store routes info."""
|
"""Store routes info."""
|
||||||
|
|
||||||
from collections.abc import Callable
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
||||||
|
|
@ -15,7 +14,7 @@ class Route:
|
||||||
|
|
||||||
url_path: str
|
url_path: str
|
||||||
route: AbstractRoute
|
route: AbstractRoute
|
||||||
handler: Callable
|
handler: callable
|
||||||
enabled: bool = False
|
enabled: bool = False
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
@ -30,7 +29,7 @@ class Routes:
|
||||||
"""Initialize routes."""
|
"""Initialize routes."""
|
||||||
self.routes = {}
|
self.routes = {}
|
||||||
|
|
||||||
def switch_route(self, coordinator: Callable, url_path: str):
|
def switch_route(self, coordinator: callable, url_path: str):
|
||||||
"""Switch route."""
|
"""Switch route."""
|
||||||
|
|
||||||
for url, route in self.routes.items():
|
for url, route in self.routes.items():
|
||||||
|
|
@ -48,7 +47,7 @@ class Routes:
|
||||||
self,
|
self,
|
||||||
url_path: str,
|
url_path: str,
|
||||||
route: AbstractRoute,
|
route: AbstractRoute,
|
||||||
handler: Callable,
|
handler: callable,
|
||||||
enabled: bool = False,
|
enabled: bool = False,
|
||||||
):
|
):
|
||||||
"""Add route."""
|
"""Add route."""
|
||||||
|
|
@ -56,7 +55,7 @@ class Routes:
|
||||||
|
|
||||||
def get_route(self, url_path: str) -> Route:
|
def get_route(self, url_path: str) -> Route:
|
||||||
"""Get route."""
|
"""Get route."""
|
||||||
return self.routes.get(url_path, Route)
|
return self.routes.get(url_path)
|
||||||
|
|
||||||
def get_enabled(self) -> str:
|
def get_enabled(self) -> str:
|
||||||
"""Get enabled routes."""
|
"""Get enabled routes."""
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import RestoreSensor, SensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.device_registry import DeviceEntryType
|
from homeassistant.helpers.device_registry import DeviceEntryType
|
||||||
|
|
@ -12,10 +12,10 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from . import WeatherDataUpdateCoordinator
|
from . import WeatherDataUpdateCoordinator
|
||||||
from .const import (
|
from .const import (
|
||||||
BATTERY_LIST,
|
|
||||||
CHILL_INDEX,
|
CHILL_INDEX,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
HEAT_INDEX,
|
HEAT_INDEX,
|
||||||
|
OUTSIDE_BATTERY,
|
||||||
OUTSIDE_HUMIDITY,
|
OUTSIDE_HUMIDITY,
|
||||||
OUTSIDE_TEMP,
|
OUTSIDE_TEMP,
|
||||||
SENSORS_TO_LOAD,
|
SENSORS_TO_LOAD,
|
||||||
|
|
@ -23,12 +23,12 @@ from .const import (
|
||||||
WIND_DIR,
|
WIND_DIR,
|
||||||
WIND_SPEED,
|
WIND_SPEED,
|
||||||
WSLINK,
|
WSLINK,
|
||||||
UnitOfBat,
|
BATTERY_LIST,
|
||||||
)
|
)
|
||||||
from .sensors_common import WeatherSensorEntityDescription
|
from .sensors_common import WeatherSensorEntityDescription
|
||||||
from .sensors_weather import SENSOR_TYPES_WEATHER_API
|
from .sensors_weather import SENSOR_TYPES_WEATHER_API
|
||||||
from .sensors_wslink import SENSOR_TYPES_WSLINK
|
from .sensors_wslink import SENSOR_TYPES_WSLINK
|
||||||
from .utils import battery_level_to_icon, battery_level_to_text, chill_index, heat_index
|
from .utils import chill_index, heat_index, battery_level_to_icon, battery_level_to_text
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -44,12 +44,12 @@ async def async_setup_entry(
|
||||||
|
|
||||||
sensors_to_load: list = []
|
sensors_to_load: list = []
|
||||||
sensors: list = []
|
sensors: list = []
|
||||||
_wslink = config_entry.options.get(WSLINK)
|
_wslink = config_entry.data.get(WSLINK)
|
||||||
|
|
||||||
SENSOR_TYPES = SENSOR_TYPES_WSLINK if _wslink else SENSOR_TYPES_WEATHER_API
|
SENSOR_TYPES = SENSOR_TYPES_WSLINK if _wslink else SENSOR_TYPES_WEATHER_API
|
||||||
|
|
||||||
# Check if we have some sensors to load.
|
# 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:
|
if WIND_DIR in sensors_to_load:
|
||||||
sensors_to_load.append(WIND_AZIMUT)
|
sensors_to_load.append(WIND_AZIMUT)
|
||||||
if (OUTSIDE_HUMIDITY in sensors_to_load) and (OUTSIDE_TEMP in sensors_to_load):
|
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)
|
async_add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class WeatherSensor( # pyright: ignore[reportIncompatibleVariableOverride]
|
class WeatherSensor(
|
||||||
CoordinatorEntity[WeatherDataUpdateCoordinator], SensorEntity
|
CoordinatorEntity[WeatherDataUpdateCoordinator], RestoreSensor, SensorEntity
|
||||||
): # pyright: ignore[reportIncompatibleVariableOverride]
|
):
|
||||||
"""Implementation of Weather Sensor entity."""
|
"""Implementation of Weather Sensor entity."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
_attr_has_entity_name = True
|
||||||
|
|
@ -94,6 +94,12 @@ class WeatherSensor( # pyright: ignore[reportIncompatibleVariableOverride]
|
||||||
|
|
||||||
self.coordinator.async_add_listener(self._handle_coordinator_update)
|
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
|
@callback
|
||||||
def _handle_coordinator_update(self) -> None:
|
def _handle_coordinator_update(self) -> None:
|
||||||
"""Handle updated data from the coordinator."""
|
"""Handle updated data from the coordinator."""
|
||||||
|
|
@ -104,30 +110,30 @@ class WeatherSensor( # pyright: ignore[reportIncompatibleVariableOverride]
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self): # pyright: ignore[reportIncompatibleVariableOverride]
|
def native_value(self) -> str | int | float | None:
|
||||||
"""Return value of entity."""
|
"""Return value of entity."""
|
||||||
|
|
||||||
_wslink = self.coordinator.config.options.get(WSLINK)
|
_wslink = self.coordinator.config.options.get(WSLINK)
|
||||||
|
|
||||||
if self.coordinator.data and (WIND_AZIMUT in self.entity_description.key):
|
if self.coordinator.data and (WIND_AZIMUT in self.entity_description.key):
|
||||||
return self.entity_description.value_fn(self.coordinator.data.get(WIND_DIR)) # pyright: ignore[ reportAttributeAccessIssue]
|
return self.entity_description.value_fn(self.coordinator.data.get(WIND_DIR))
|
||||||
|
|
||||||
if (
|
if (
|
||||||
self.coordinator.data
|
self.coordinator.data
|
||||||
and (HEAT_INDEX in self.entity_description.key)
|
and (HEAT_INDEX in self.entity_description.key)
|
||||||
and not _wslink
|
and not _wslink
|
||||||
):
|
):
|
||||||
return self.entity_description.value_fn(heat_index(self.coordinator.data)) # pyright: ignore[ reportAttributeAccessIssue]
|
return self.entity_description.value_fn(heat_index(self.coordinator.data))
|
||||||
|
|
||||||
if (
|
if (
|
||||||
self.coordinator.data
|
self.coordinator.data
|
||||||
and (CHILL_INDEX in self.entity_description.key)
|
and (CHILL_INDEX in self.entity_description.key)
|
||||||
and not _wslink
|
and not _wslink
|
||||||
):
|
):
|
||||||
return self.entity_description.value_fn(chill_index(self.coordinator.data)) # pyright: ignore[ reportAttributeAccessIssue]
|
return self.entity_description.value_fn(chill_index(self.coordinator.data))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
None if self._data == "" else self.entity_description.value_fn(self._data) # pyright: ignore[ reportAttributeAccessIssue]
|
None if self._data == "" else self.entity_description.value_fn(self._data)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
@ -136,20 +142,19 @@ class WeatherSensor( # pyright: ignore[reportIncompatibleVariableOverride]
|
||||||
return generate_entity_id("sensor.{}", self.entity_description.key)
|
return generate_entity_id("sensor.{}", self.entity_description.key)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def icon(self) -> str | None: # pyright: ignore[reportIncompatibleVariableOverride]
|
def icon(self) -> str | None:
|
||||||
"""Return the dynamic icon for battery representation."""
|
"""Return the dynamic icon for battery representation."""
|
||||||
|
|
||||||
if self.entity_description.key in BATTERY_LIST:
|
if self.entity_description.key in BATTERY_LIST:
|
||||||
if self.native_value:
|
try:
|
||||||
battery_level = battery_level_to_text(self.native_value)
|
return battery_level_to_icon(self.native_value)
|
||||||
return battery_level_to_icon(battery_level)
|
except Exception:
|
||||||
|
return "mdi:battery-unknown"
|
||||||
return battery_level_to_icon(UnitOfBat.UNKNOWN)
|
|
||||||
|
|
||||||
return self.entity_description.icon
|
return self.entity_description.icon
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self) -> DeviceInfo: # pyright: ignore[reportIncompatibleVariableOverride]
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Device info."""
|
"""Device info."""
|
||||||
return DeviceInfo(
|
return DeviceInfo(
|
||||||
connections=set(),
|
connections=set(),
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,14 @@ from homeassistant.const import (
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
BARO_PRESSURE,
|
BARO_PRESSURE,
|
||||||
CH2_BATTERY,
|
|
||||||
CH2_HUMIDITY,
|
CH2_HUMIDITY,
|
||||||
CH2_TEMP,
|
CH2_TEMP,
|
||||||
|
CH2_BATTERY,
|
||||||
|
INDOOR_BATTERY,
|
||||||
CH3_HUMIDITY,
|
CH3_HUMIDITY,
|
||||||
CH3_TEMP,
|
CH3_TEMP,
|
||||||
|
CH4_HUMIDITY,
|
||||||
|
CH4_TEMP,
|
||||||
CHILL_INDEX,
|
CHILL_INDEX,
|
||||||
DAILY_RAIN,
|
DAILY_RAIN,
|
||||||
DEW_POINT,
|
DEW_POINT,
|
||||||
|
|
@ -30,6 +33,7 @@ from .const import (
|
||||||
INDOOR_BATTERY,
|
INDOOR_BATTERY,
|
||||||
INDOOR_HUMIDITY,
|
INDOOR_HUMIDITY,
|
||||||
INDOOR_TEMP,
|
INDOOR_TEMP,
|
||||||
|
INDOOR_BATTERY,
|
||||||
MONTHLY_RAIN,
|
MONTHLY_RAIN,
|
||||||
OUTSIDE_BATTERY,
|
OUTSIDE_BATTERY,
|
||||||
OUTSIDE_HUMIDITY,
|
OUTSIDE_HUMIDITY,
|
||||||
|
|
@ -37,7 +41,6 @@ from .const import (
|
||||||
RAIN,
|
RAIN,
|
||||||
SOLAR_RADIATION,
|
SOLAR_RADIATION,
|
||||||
UV,
|
UV,
|
||||||
WBGT_TEMP,
|
|
||||||
WEEKLY_RAIN,
|
WEEKLY_RAIN,
|
||||||
WIND_AZIMUT,
|
WIND_AZIMUT,
|
||||||
WIND_DIR,
|
WIND_DIR,
|
||||||
|
|
@ -45,9 +48,10 @@ from .const import (
|
||||||
WIND_SPEED,
|
WIND_SPEED,
|
||||||
YEARLY_RAIN,
|
YEARLY_RAIN,
|
||||||
UnitOfDir,
|
UnitOfDir,
|
||||||
|
WBGT_TEMP,
|
||||||
)
|
)
|
||||||
from .sensors_common import WeatherSensorEntityDescription
|
from .sensors_common import WeatherSensorEntityDescription
|
||||||
from .utils import wind_dir_to_text
|
from .utils import battery_level_to_icon, battery_level_to_text, wind_dir_to_text
|
||||||
|
|
||||||
SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
|
SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
|
||||||
WeatherSensorEntityDescription(
|
WeatherSensorEntityDescription(
|
||||||
|
|
@ -254,7 +258,7 @@ SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
|
||||||
suggested_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
suggested_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
icon="mdi:weather-sunny",
|
icon="mdi:weather-sunny",
|
||||||
translation_key=CH3_TEMP,
|
translation_key=CH3_TEMP,
|
||||||
value_fn=lambda data: cast("float", data),
|
value_fn=lambda data: cast(float, data),
|
||||||
),
|
),
|
||||||
WeatherSensorEntityDescription(
|
WeatherSensorEntityDescription(
|
||||||
key=CH3_HUMIDITY,
|
key=CH3_HUMIDITY,
|
||||||
|
|
@ -263,7 +267,7 @@ SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
|
||||||
device_class=SensorDeviceClass.HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
icon="mdi:weather-sunny",
|
icon="mdi:weather-sunny",
|
||||||
translation_key=CH3_HUMIDITY,
|
translation_key=CH3_HUMIDITY,
|
||||||
value_fn=lambda data: cast("int", data),
|
value_fn=lambda data: cast(int, data),
|
||||||
),
|
),
|
||||||
# WeatherSensorEntityDescription(
|
# WeatherSensorEntityDescription(
|
||||||
# key=CH4_TEMP,
|
# key=CH4_TEMP,
|
||||||
|
|
@ -311,21 +315,21 @@ SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = (
|
||||||
translation_key=OUTSIDE_BATTERY,
|
translation_key=OUTSIDE_BATTERY,
|
||||||
icon="mdi:battery-unknown",
|
icon="mdi:battery-unknown",
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
value_fn=lambda data: (data),
|
value_fn=lambda data: battery_level_to_text(data),
|
||||||
),
|
),
|
||||||
WeatherSensorEntityDescription(
|
WeatherSensorEntityDescription(
|
||||||
key=CH2_BATTERY,
|
key=CH2_BATTERY,
|
||||||
translation_key=CH2_BATTERY,
|
translation_key=CH2_BATTERY,
|
||||||
icon="mdi:battery-unknown",
|
icon="mdi:battery-unknown",
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
value_fn=lambda data: (data),
|
value_fn=lambda data: battery_level_to_text(data),
|
||||||
),
|
),
|
||||||
WeatherSensorEntityDescription(
|
WeatherSensorEntityDescription(
|
||||||
key=INDOOR_BATTERY,
|
key=INDOOR_BATTERY,
|
||||||
translation_key=INDOOR_BATTERY,
|
translation_key=INDOOR_BATTERY,
|
||||||
icon="mdi:battery-unknown",
|
icon="mdi:battery-unknown",
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
value_fn=lambda data: (data),
|
value_fn=lambda data: battery_level_to_text(data),
|
||||||
),
|
),
|
||||||
WeatherSensorEntityDescription(
|
WeatherSensorEntityDescription(
|
||||||
key=WBGT_TEMP,
|
key=WBGT_TEMP,
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
"valid_credentials_key": "Provide valid API KEY.",
|
"valid_credentials_key": "Provide valid API KEY.",
|
||||||
"valid_credentials_match": "API ID and API KEY should not be the same."
|
"valid_credentials_match": "API ID and API KEY should not be the same."
|
||||||
},
|
},
|
||||||
|
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
||||||
|
|
@ -24,6 +25,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"options": {
|
"options": {
|
||||||
"error": {
|
"error": {
|
||||||
"valid_credentials_api": "Provide valid API ID.",
|
"valid_credentials_api": "Provide valid API ID.",
|
||||||
|
|
@ -31,6 +33,7 @@
|
||||||
"valid_credentials_match": "API ID and API KEY should not be the same.",
|
"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."
|
"windy_key_required": "Windy API key is required if you want to enable this function."
|
||||||
},
|
},
|
||||||
|
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"title": "Configure SWS12500 Integration",
|
"title": "Configure SWS12500 Integration",
|
||||||
|
|
@ -40,6 +43,7 @@
|
||||||
"windy": "Windy configuration"
|
"windy": "Windy configuration"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"basic": {
|
"basic": {
|
||||||
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
||||||
"title": "Configure credentials",
|
"title": "Configure credentials",
|
||||||
|
|
@ -56,6 +60,7 @@
|
||||||
"WSLINK": "Enable WSLink API if the station is set to send data via WSLink."
|
"WSLINK": "Enable WSLink API if the station is set to send data via WSLink."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"windy": {
|
"windy": {
|
||||||
"description": "Resend weather data to your Windy stations.",
|
"description": "Resend weather data to your Windy stations.",
|
||||||
"title": "Configure Windy",
|
"title": "Configure Windy",
|
||||||
|
|
@ -69,24 +74,6 @@
|
||||||
"windy_logger_checkbox": "Enable only if you want to send debuging data to the developer."
|
"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": {
|
"migration": {
|
||||||
"title": "Statistic 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.",
|
"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.",
|
||||||
|
|
@ -101,71 +88,30 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"entity": {
|
"entity": {
|
||||||
"sensor": {
|
"sensor": {
|
||||||
"indoor_temp": {
|
"indoor_temp": { "name": "Indoor temperature" },
|
||||||
"name": "Indoor temperature"
|
"indoor_humidity": { "name": "Indoor humidity" },
|
||||||
},
|
"outside_temp": { "name": "Outside Temperature" },
|
||||||
"indoor_humidity": {
|
"outside_humidity": { "name": "Outside humidity" },
|
||||||
"name": "Indoor humidity"
|
"uv": { "name": "UV index" },
|
||||||
},
|
"baro_pressure": { "name": "Barometric pressure" },
|
||||||
"outside_temp": {
|
"dew_point": { "name": "Dew point" },
|
||||||
"name": "Outside Temperature"
|
"wind_speed": { "name": "Wind speed" },
|
||||||
},
|
"wind_dir": { "name": "Wind direction" },
|
||||||
"outside_humidity": {
|
"wind_gust": { "name": "Wind gust" },
|
||||||
"name": "Outside humidity"
|
"rain": { "name": "Rain" },
|
||||||
},
|
"daily_rain": { "name": "Daily precipitation" },
|
||||||
"uv": {
|
"solar_radiation": { "name": "Solar irradiance" },
|
||||||
"name": "UV index"
|
"ch2_temp": { "name": "Channel 2 temperature" },
|
||||||
},
|
"ch2_humidity": { "name": "Channel 2 humidity" },
|
||||||
"baro_pressure": {
|
"ch3_temp": { "name": "Channel 3 temperature" },
|
||||||
"name": "Barometric pressure"
|
"ch3_humidity": { "name": "Channel 3 humidity" },
|
||||||
},
|
"ch4_temp": { "name": "Channel 4 temperature" },
|
||||||
"dew_point": {
|
"ch4_humidity": { "name": "Channel 4 humidity" },
|
||||||
"name": "Dew point"
|
"heat_index": { "name": "Apparent temperature" },
|
||||||
},
|
"chill_index": { "name": "Wind chill" },
|
||||||
"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": {
|
"wind_azimut": {
|
||||||
"name": "Bearing",
|
"name": "Bearing",
|
||||||
"state": {
|
"state": {
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"options": {
|
"options": {
|
||||||
"error": {
|
"error": {
|
||||||
"valid_credentials_api": "Vyplňte platné API ID",
|
"valid_credentials_api": "Vyplňte platné API ID",
|
||||||
"valid_credentials_key": "Vyplňte platný API KEY",
|
"valid_credentials_key": "Vyplňte platný API KEY",
|
||||||
"valid_credentials_match": "API ID a API KEY nesmějí být stejné!",
|
"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": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"title": "Nastavení integrace SWS12500",
|
"title": "Nastavení integrace SWS12500",
|
||||||
|
|
@ -41,10 +40,10 @@
|
||||||
"menu_options": {
|
"menu_options": {
|
||||||
"basic": "Základní - přístupové údaje (přihlášení)",
|
"basic": "Základní - přístupové údaje (přihlášení)",
|
||||||
"windy": "Nastavení pro přeposílání dat na Windy",
|
"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"
|
"migration": "Migrace statistiky senzoru"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"basic": {
|
"basic": {
|
||||||
"description": "Zadejte API ID a API KEY, aby meteostanice mohla komunikovat s HomeAssistantem",
|
"description": "Zadejte API ID a API KEY, aby meteostanice mohla komunikovat s HomeAssistantem",
|
||||||
"title": "Nastavení přihlášení",
|
"title": "Nastavení přihlášení",
|
||||||
|
|
@ -61,6 +60,7 @@
|
||||||
"wslink": "WSLink API zapněte, pokud je stanice nastavena na zasílání dat přes WSLink."
|
"wslink": "WSLink API zapněte, pokud je stanice nastavena na zasílání dat přes WSLink."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"windy": {
|
"windy": {
|
||||||
"description": "Přeposílání dat z metostanice na Windy",
|
"description": "Přeposílání dat z metostanice na Windy",
|
||||||
"title": "Konfigurace Windy",
|
"title": "Konfigurace Windy",
|
||||||
|
|
@ -70,28 +70,10 @@
|
||||||
"windy_logger_checkbox": "Logovat data a odpovědi z Windy"
|
"windy_logger_checkbox": "Logovat data a odpovědi z Windy"
|
||||||
},
|
},
|
||||||
"data_description": {
|
"data_description": {
|
||||||
"WINDY_API_KEY": "Klíč API KEY získaný z https://api.windy.com/keys",
|
"WINDY_API_KEY": "Klíč API KEY získaný z https://https://api.windy.com/keys",
|
||||||
"windy_logger_checkbox": "Zapnout pouze v případě, že chcete poslat ladící informace vývojáři."
|
"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": {
|
"migration": {
|
||||||
"title": "Migrace statistiky senzoru.",
|
"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ů.",
|
"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ů.",
|
||||||
|
|
@ -106,86 +88,35 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"entity": {
|
"entity": {
|
||||||
"sensor": {
|
"sensor": {
|
||||||
"indoor_temp": {
|
"indoor_temp": { "name": "Vnitřní teplota" },
|
||||||
"name": "Vnitřní teplota"
|
"indoor_humidity": { "name": "Vnitřní vlhkost vzduchu" },
|
||||||
},
|
"outside_temp": { "name": "Venkovní teplota" },
|
||||||
"indoor_humidity": {
|
"outside_humidity": { "name": "Venkovní vlhkost vzduchu" },
|
||||||
"name": "Vnitřní vlhkost vzduchu"
|
"uv": { "name": "UV index" },
|
||||||
},
|
"baro_pressure": { "name": "Tlak vzduchu" },
|
||||||
"outside_temp": {
|
"dew_point": { "name": "Rosný bod" },
|
||||||
"name": "Venkovní teplota"
|
"wind_speed": { "name": "Rychlost větru" },
|
||||||
},
|
"wind_dir": { "name": "Směr větru" },
|
||||||
"outside_humidity": {
|
"wind_gust": { "name": "Poryvy větru" },
|
||||||
"name": "Venkovní vlhkost vzduchu"
|
"rain": { "name": "Srážky" },
|
||||||
},
|
"daily_rain": { "name": "Denní úhrn srážek" },
|
||||||
"uv": {
|
"solar_radiation": { "name": "Sluneční osvit" },
|
||||||
"name": "UV index"
|
"ch2_temp": { "name": "Teplota senzoru 2" },
|
||||||
},
|
"ch2_humidity": { "name": "Vlhkost sensoru 2" },
|
||||||
"baro_pressure": {
|
"ch3_temp": { "name": "Teplota senzoru 3" },
|
||||||
"name": "Tlak vzduchu"
|
"ch3_humidity": { "name": "Vlhkost sensoru 3" },
|
||||||
},
|
"ch4_temp": { "name": "Teplota senzoru 4" },
|
||||||
"dew_point": {
|
"ch4_humidity": { "name": "Vlhkost sensoru 4" },
|
||||||
"name": "Rosný bod"
|
"heat_index": { "name": "Tepelný index" },
|
||||||
},
|
"chill_index": { "name": "Pocitová teplota" },
|
||||||
"wind_speed": {
|
"hourly_rain": { "name": "Hodinový úhrn srážek" },
|
||||||
"name": "Rychlost větru"
|
"weekly_rain": { "name": "Týdenní úhrn srážek" },
|
||||||
},
|
"monthly_rain": { "name": "Měsíční úhrn srážek" },
|
||||||
"wind_dir": {
|
"yearly_rain": { "name": "Roční úhrn srážek" },
|
||||||
"name": "Směr větru"
|
"wbgt_temp": { "name": "WBGT index" },
|
||||||
},
|
|
||||||
"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": {
|
"wind_azimut": {
|
||||||
"name": "Azimut",
|
"name": "Azimut",
|
||||||
"state": {
|
"state": {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
"valid_credentials_key": "Provide valid API KEY.",
|
"valid_credentials_key": "Provide valid API KEY.",
|
||||||
"valid_credentials_match": "API ID and API KEY should not be the same."
|
"valid_credentials_match": "API ID and API KEY should not be the same."
|
||||||
},
|
},
|
||||||
|
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
||||||
|
|
@ -24,6 +25,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"options": {
|
"options": {
|
||||||
"error": {
|
"error": {
|
||||||
"valid_credentials_api": "Provide valid API ID.",
|
"valid_credentials_api": "Provide valid API ID.",
|
||||||
|
|
@ -31,6 +33,7 @@
|
||||||
"valid_credentials_match": "API ID and API KEY should not be the same.",
|
"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."
|
"windy_key_required": "Windy API key is required if you want to enable this function."
|
||||||
},
|
},
|
||||||
|
|
||||||
"step": {
|
"step": {
|
||||||
"init": {
|
"init": {
|
||||||
"title": "Configure SWS12500 Integration",
|
"title": "Configure SWS12500 Integration",
|
||||||
|
|
@ -40,6 +43,7 @@
|
||||||
"windy": "Windy configuration"
|
"windy": "Windy configuration"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"basic": {
|
"basic": {
|
||||||
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
"description": "Provide API ID and API KEY so the Weather Station can access HomeAssistant",
|
||||||
"title": "Configure credentials",
|
"title": "Configure credentials",
|
||||||
|
|
@ -56,6 +60,7 @@
|
||||||
"WSLINK": "Enable WSLink API if the station is set to send data via WSLink."
|
"WSLINK": "Enable WSLink API if the station is set to send data via WSLink."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"windy": {
|
"windy": {
|
||||||
"description": "Resend weather data to your Windy stations.",
|
"description": "Resend weather data to your Windy stations.",
|
||||||
"title": "Configure Windy",
|
"title": "Configure Windy",
|
||||||
|
|
@ -69,24 +74,6 @@
|
||||||
"windy_logger_checkbox": "Enable only if you want to send debuging data to the developer."
|
"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": {
|
"migration": {
|
||||||
"title": "Statistic 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.",
|
"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.",
|
||||||
|
|
@ -101,86 +88,35 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"entity": {
|
"entity": {
|
||||||
"sensor": {
|
"sensor": {
|
||||||
"indoor_temp": {
|
"indoor_temp": { "name": "Indoor temperature" },
|
||||||
"name": "Indoor temperature"
|
"indoor_humidity": { "name": "Indoor humidity" },
|
||||||
},
|
"outside_temp": { "name": "Outside Temperature" },
|
||||||
"indoor_humidity": {
|
"outside_humidity": { "name": "Outside humidity" },
|
||||||
"name": "Indoor humidity"
|
"uv": { "name": "UV index" },
|
||||||
},
|
"baro_pressure": { "name": "Barometric pressure" },
|
||||||
"outside_temp": {
|
"dew_point": { "name": "Dew point" },
|
||||||
"name": "Outside Temperature"
|
"wind_speed": { "name": "Wind speed" },
|
||||||
},
|
"wind_dir": { "name": "Wind direction" },
|
||||||
"outside_humidity": {
|
"wind_gust": { "name": "Wind gust" },
|
||||||
"name": "Outside humidity"
|
"rain": { "name": "Rain" },
|
||||||
},
|
"daily_rain": { "name": "Daily precipitation" },
|
||||||
"uv": {
|
"solar_radiation": { "name": "Solar irradiance" },
|
||||||
"name": "UV index"
|
"ch2_temp": { "name": "Channel 2 temperature" },
|
||||||
},
|
"ch2_humidity": { "name": "Channel 2 humidity" },
|
||||||
"baro_pressure": {
|
"ch3_temp": { "name": "Channel 3 temperature" },
|
||||||
"name": "Barometric pressure"
|
"ch3_humidity": { "name": "Channel 3 humidity" },
|
||||||
},
|
"ch4_temp": { "name": "Channel 4 temperature" },
|
||||||
"dew_point": {
|
"ch4_humidity": { "name": "Channel 4 humidity" },
|
||||||
"name": "Dew point"
|
"heat_index": { "name": "Apparent temperature" },
|
||||||
},
|
"chill_index": { "name": "Wind chill" },
|
||||||
"wind_speed": {
|
"hourly_rain": { "name": "Hourly precipitation" },
|
||||||
"name": "Wind speed"
|
"weekly_rain": { "name": "Weekly precipitation" },
|
||||||
},
|
"monthly_rain": { "name": "Monthly precipitation" },
|
||||||
"wind_dir": {
|
"yearly_rain": { "name": "Yearly precipitation" },
|
||||||
"name": "Wind direction"
|
"wbgt_index": { "name": "WBGT index" },
|
||||||
},
|
|
||||||
"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": {
|
"wind_azimut": {
|
||||||
"name": "Bearing",
|
"name": "Bearing",
|
||||||
"state": {
|
"state": {
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,17 @@ import numpy as np
|
||||||
|
|
||||||
from homeassistant.components import persistent_notification
|
from homeassistant.components import persistent_notification
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
from homeassistant.const import (
|
||||||
|
UnitOfPrecipitationDepth,
|
||||||
|
UnitOfTemperature,
|
||||||
|
UnitOfVolumetricFlux,
|
||||||
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.translation import async_get_translations
|
from homeassistant.helpers.translation import async_get_translations
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
AZIMUT,
|
AZIMUT,
|
||||||
|
BATTERY_LEVEL,
|
||||||
DATABASE_PATH,
|
DATABASE_PATH,
|
||||||
DEV_DBG,
|
DEV_DBG,
|
||||||
OUTSIDE_HUMIDITY,
|
OUTSIDE_HUMIDITY,
|
||||||
|
|
@ -23,8 +29,8 @@ from .const import (
|
||||||
REMAP_WSLINK_ITEMS,
|
REMAP_WSLINK_ITEMS,
|
||||||
SENSORS_TO_LOAD,
|
SENSORS_TO_LOAD,
|
||||||
WIND_SPEED,
|
WIND_SPEED,
|
||||||
UnitOfBat,
|
|
||||||
UnitOfDir,
|
UnitOfDir,
|
||||||
|
UnitOfBat,
|
||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
@ -49,7 +55,7 @@ async def translations(
|
||||||
)
|
)
|
||||||
if localize_key in _translations:
|
if localize_key in _translations:
|
||||||
return _translations[localize_key]
|
return _translations[localize_key]
|
||||||
return ""
|
return None
|
||||||
|
|
||||||
|
|
||||||
async def translated_notification(
|
async def translated_notification(
|
||||||
|
|
@ -61,7 +67,7 @@ async def translated_notification(
|
||||||
*,
|
*,
|
||||||
key: str = "message",
|
key: str = "message",
|
||||||
category: str = "notify",
|
category: str = "notify",
|
||||||
):
|
) -> str:
|
||||||
"""Translate notification."""
|
"""Translate notification."""
|
||||||
|
|
||||||
localize_key = f"component.{translation_domain}.{category}.{translation_key}.{key}"
|
localize_key = f"component.{translation_domain}.{category}.{translation_key}.{key}"
|
||||||
|
|
@ -92,7 +98,7 @@ async def translated_notification(
|
||||||
|
|
||||||
async def update_options(
|
async def update_options(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, update_key, update_value
|
hass: HomeAssistant, entry: ConfigEntry, update_key, update_value
|
||||||
) -> bool:
|
) -> None:
|
||||||
"""Update config.options entry."""
|
"""Update config.options entry."""
|
||||||
conf = {**entry.options}
|
conf = {**entry.options}
|
||||||
conf[update_key] = update_value
|
conf[update_key] = update_value
|
||||||
|
|
@ -147,7 +153,7 @@ def check_disabled(
|
||||||
Returns list of found sensors or None
|
Returns list of found sensors or None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
log: bool = config_entry.options.get(DEV_DBG, False)
|
log: bool = config_entry.options.get(DEV_DBG)
|
||||||
entityFound: bool = False
|
entityFound: bool = False
|
||||||
_loaded_sensors = loaded_sensors(config_entry)
|
_loaded_sensors = loaded_sensors(config_entry)
|
||||||
missing_sensors: list = []
|
missing_sensors: list = []
|
||||||
|
|
@ -183,15 +189,10 @@ def battery_level_to_text(battery: int) -> UnitOfBat:
|
||||||
Returns UnitOfBat
|
Returns UnitOfBat
|
||||||
"""
|
"""
|
||||||
|
|
||||||
level_map: dict[int, UnitOfBat] = {
|
return {
|
||||||
0: UnitOfBat.LOW,
|
0: UnitOfBat.LOW,
|
||||||
1: UnitOfBat.NORMAL,
|
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:
|
def battery_level_to_icon(battery: UnitOfBat) -> str:
|
||||||
|
|
@ -218,7 +219,7 @@ def celsius_to_fahrenheit(celsius: float) -> float:
|
||||||
return celsius * 9.0 / 5.0 + 32
|
return celsius * 9.0 / 5.0 + 32
|
||||||
|
|
||||||
|
|
||||||
def heat_index(data: Any, convert: bool = False) -> float:
|
def heat_index(data: Any, convert: bool = False) -> UnitOfTemperature:
|
||||||
"""Calculate heat index from temperature.
|
"""Calculate heat index from temperature.
|
||||||
|
|
||||||
data: dict with temperature and humidity
|
data: dict with temperature and humidity
|
||||||
|
|
@ -256,7 +257,7 @@ def heat_index(data: Any, convert: bool = False) -> float:
|
||||||
return simple
|
return simple
|
||||||
|
|
||||||
|
|
||||||
def chill_index(data: Any, convert: bool = False) -> float:
|
def chill_index(data: Any, convert: bool = False) -> UnitOfTemperature:
|
||||||
"""Calculate wind chill index from temperature and wind speed.
|
"""Calculate wind chill index from temperature and wind speed.
|
||||||
|
|
||||||
data: dict with temperature and wind speed
|
data: dict with temperature and wind speed
|
||||||
|
|
@ -285,7 +286,7 @@ def chill_index(data: Any, convert: bool = False) -> float:
|
||||||
|
|
||||||
def long_term_units_in_statistics_meta():
|
def long_term_units_in_statistics_meta():
|
||||||
"""Get units in long term statitstics."""
|
"""Get units in long term statitstics."""
|
||||||
sensor_units = []
|
|
||||||
if not Path(DATABASE_PATH).exists():
|
if not Path(DATABASE_PATH).exists():
|
||||||
_LOGGER.error("Database file not found: %s", DATABASE_PATH)
|
_LOGGER.error("Database file not found: %s", DATABASE_PATH)
|
||||||
return False
|
return False
|
||||||
|
|
@ -313,7 +314,7 @@ def long_term_units_in_statistics_meta():
|
||||||
return sensor_units
|
return sensor_units
|
||||||
|
|
||||||
|
|
||||||
async def migrate_data(hass: HomeAssistant, sensor_id: str | None = None) -> int | bool:
|
async def migrate_data(hass: HomeAssistant, sensor_id: str | None = None) -> bool:
|
||||||
"""Migrate data from mm/d to mm."""
|
"""Migrate data from mm/d to mm."""
|
||||||
|
|
||||||
_LOGGER.debug("Sensor %s is required for data migration", sensor_id)
|
_LOGGER.debug("Sensor %s is required for data migration", sensor_id)
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from aiohttp.client_exceptions import ClientError
|
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
|
@ -108,7 +106,7 @@ class WindyPush:
|
||||||
if self.next_update > datetime.now():
|
if self.next_update > datetime.now():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
purged_data = data.copy()
|
purged_data = dict(data)
|
||||||
|
|
||||||
for purge in PURGE_DATA:
|
for purge in PURGE_DATA:
|
||||||
if purge in purged_data:
|
if purge in purged_data:
|
||||||
|
|
@ -140,20 +138,20 @@ class WindyPush:
|
||||||
_LOGGER.critical(WINDY_INVALID_KEY)
|
_LOGGER.critical(WINDY_INVALID_KEY)
|
||||||
text_for_test = WINDY_INVALID_KEY
|
text_for_test = WINDY_INVALID_KEY
|
||||||
|
|
||||||
await update_options(self.hass, self.config, WINDY_ENABLED, False)
|
update_options(self.hass, self.config, WINDY_ENABLED, False)
|
||||||
|
|
||||||
except WindySuccess:
|
except WindySuccess:
|
||||||
if self.log:
|
if self.log:
|
||||||
_LOGGER.info(WINDY_SUCCESS)
|
_LOGGER.info(WINDY_SUCCESS)
|
||||||
text_for_test = WINDY_SUCCESS
|
text_for_test = WINDY_SUCCESS
|
||||||
|
|
||||||
except ClientError as ex:
|
except session.ClientError as ex:
|
||||||
_LOGGER.critical("Invalid response from Windy: %s", str(ex))
|
_LOGGER.critical("Invalid response from Windy: %s", str(ex))
|
||||||
self.invalid_response_count += 1
|
self.invalid_response_count += 1
|
||||||
if self.invalid_response_count > 3:
|
if self.invalid_response_count > 3:
|
||||||
_LOGGER.critical(WINDY_UNEXPECTED)
|
_LOGGER.critical(WINDY_UNEXPECTED)
|
||||||
text_for_test = WINDY_UNEXPECTED
|
text_for_test = WINDY_UNEXPECTED
|
||||||
await update_options(self.hass, self.config, WINDY_ENABLED, False)
|
update_options(self.hass, self.config, WINDY_ENABLED, False)
|
||||||
|
|
||||||
self.last_update = datetime.now()
|
self.last_update = datetime.now()
|
||||||
self.next_update = self.last_update + timed(minutes=5)
|
self.next_update = self.last_update + timed(minutes=5)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue