Compare commits
No commits in common. "214b8581b08bb74f0e47552afdcecc2ed31c56e7" and "0c67b8d2ab94cb6bb860affd5820dbe0bc24eb04" have entirely different histories.
214b8581b0
...
0c67b8d2ab
|
|
@ -24,7 +24,7 @@ from .const import (
|
||||||
POCASI_INVALID_KEY,
|
POCASI_INVALID_KEY,
|
||||||
WSLINK_URL,
|
WSLINK_URL,
|
||||||
)
|
)
|
||||||
from .utils import anonymize, update_options
|
from .utils import update_options
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -117,12 +117,12 @@ class PocasiPush:
|
||||||
_data["PASSWORD"] = _api_key
|
_data["PASSWORD"] = _api_key
|
||||||
request_url = f"{POCASI_CZ_URL}{DEFAULT_URL}"
|
request_url = f"{POCASI_CZ_URL}{DEFAULT_URL}"
|
||||||
|
|
||||||
session = async_get_clientsession(self.hass)
|
session = async_get_clientsession(self.hass, verify_ssl=False)
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Payload for Pocasi Meteo server: [mode=%s] [request_url=%s] = %s",
|
"Payload for Pocasi Meteo server: [mode=%s] [request_url=%s] = %s",
|
||||||
mode,
|
mode,
|
||||||
request_url,
|
request_url,
|
||||||
anonymize(_data),
|
_data,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
async with session.get(request_url, params=_data) as resp:
|
async with session.get(request_url, params=_data) as resp:
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class RouteInfo:
|
||||||
url_path: str
|
url_path: str
|
||||||
handler: Handler
|
handler: Handler
|
||||||
enabled: bool = False
|
enabled: bool = False
|
||||||
fallback: Handler = field(default_factory=lambda: unregistered)
|
fallback: Handler = field(default_factory=lambda: unregistred)
|
||||||
|
|
||||||
|
|
||||||
class Routes:
|
class Routes:
|
||||||
|
|
@ -57,7 +57,7 @@ class Routes:
|
||||||
info = self.routes.get(request.path)
|
info = self.routes.get(request.path)
|
||||||
if not info:
|
if not info:
|
||||||
_LOGGER.debug("Route %s is not registered!", request.path)
|
_LOGGER.debug("Route %s is not registered!", request.path)
|
||||||
return await unregistered(request)
|
return await unregistred(request)
|
||||||
handler = info.handler if info.enabled else info.fallback
|
handler = info.handler if info.enabled else info.fallback
|
||||||
return await handler(request)
|
return await handler(request)
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ class Routes:
|
||||||
return "No routes is enabled."
|
return "No routes is enabled."
|
||||||
|
|
||||||
|
|
||||||
async def unregistered(request: Request) -> Response:
|
async def unregistred(request: Request) -> Response:
|
||||||
"""Fallback response for unknown/disabled routes.
|
"""Fallback response for unknown/disabled routes.
|
||||||
|
|
||||||
This should normally never happen for correctly configured stations, but it provides
|
This should normally never happen for correctly configured stations, but it provides
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import logging
|
||||||
import math
|
import math
|
||||||
from typing import Any, cast
|
from typing import Any, cast
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
from py_typecheck.core import checked_or
|
from py_typecheck.core import checked_or
|
||||||
|
|
||||||
from homeassistant.components import persistent_notification
|
from homeassistant.components import persistent_notification
|
||||||
|
|
@ -316,10 +317,10 @@ def heat_index(
|
||||||
+ 0.00085282 * temp * rh * rh
|
+ 0.00085282 * temp * rh * rh
|
||||||
- 0.00000199 * temp * temp * rh * rh
|
- 0.00000199 * temp * temp * rh * rh
|
||||||
)
|
)
|
||||||
if rh < 13 and (80 <= temp <= 112):
|
if rh < 13 and (temp in np.arange(80, 112, 0.1)):
|
||||||
adjustment = ((13 - rh) / 4) * math.sqrt((17 - abs(temp - 95)) / 17)
|
adjustment = ((13 - rh) / 4) * math.sqrt((17 - abs(temp - 95)) / 17)
|
||||||
|
|
||||||
if rh > 80 and (80 <= temp <= 87):
|
if rh > 80 and (temp in np.arange(80, 87, 0.1)):
|
||||||
adjustment = ((rh - 85) / 10) * ((87 - temp) / 5)
|
adjustment = ((rh - 85) / 10) * ((87 - temp) / 5)
|
||||||
|
|
||||||
return round((full_index + adjustment if adjustment else full_index), 2)
|
return round((full_index + adjustment if adjustment else full_index), 2)
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ class WindyPush:
|
||||||
|
|
||||||
if self.log:
|
if self.log:
|
||||||
_LOGGER.info("Dataset for windy: %s", purged_data)
|
_LOGGER.info("Dataset for windy: %s", purged_data)
|
||||||
session = async_get_clientsession(self.hass)
|
session = async_get_clientsession(self.hass, verify_ssl=False)
|
||||||
try:
|
try:
|
||||||
async with session.get(
|
async with session.get(
|
||||||
request_url, params=purged_data, headers=headers
|
request_url, params=purged_data, headers=headers
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue