Compare commits

..

4 Commits

4 changed files with 9 additions and 10 deletions

View File

@ -24,7 +24,7 @@ from .const import (
POCASI_INVALID_KEY, POCASI_INVALID_KEY,
WSLINK_URL, WSLINK_URL,
) )
from .utils import update_options from .utils import anonymize, 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, verify_ssl=False) session = async_get_clientsession(self.hass)
_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,
_data, anonymize(_data),
) )
try: try:
async with session.get(request_url, params=_data) as resp: async with session.get(request_url, params=_data) as resp:

View File

@ -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: unregistred) fallback: Handler = field(default_factory=lambda: unregistered)
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 unregistred(request) return await unregistered(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 unregistred(request: Request) -> Response: async def unregistered(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

View File

@ -15,7 +15,6 @@ 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
@ -317,10 +316,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 (temp in np.arange(80, 112, 0.1)): if rh < 13 and (80 <= temp <= 112):
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 (temp in np.arange(80, 87, 0.1)): if rh > 80 and (80 <= temp <= 87):
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)

View File

@ -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, verify_ssl=False) session = async_get_clientsession(self.hass)
try: try:
async with session.get( async with session.get(
request_url, params=purged_data, headers=headers request_url, params=purged_data, headers=headers