Add developer log.
parent
400b449e44
commit
ad2fad8001
|
|
@ -11,8 +11,8 @@ from homeassistant.exceptions import InvalidStateError, PlatformNotReady
|
|||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from .const import API_ID, API_KEY, DEFAULT_URL, DOMAIN, WINDY_ENABLED
|
||||
from .utils import remap_items
|
||||
from .const import API_ID, API_KEY, DEFAULT_URL, DEV_DBG, DOMAIN, WINDY_ENABLED
|
||||
from .utils import anonymize, remap_items
|
||||
from .windy_func import WindyPush
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
@ -57,8 +57,10 @@ class WeatherDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
|
||||
self.async_set_updated_data(remap_items(data))
|
||||
|
||||
response = response if response else "OK"
|
||||
if self.config_entry.options.get(DEV_DBG):
|
||||
_LOGGER.info("Dev log: %s", anonymize(data))
|
||||
|
||||
response = response if response else "OK"
|
||||
return aiohttp.web.Response(body=f"{response}", status=200)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,17 @@ def update_options(
|
|||
hass.config_entries.async_update_entry(entry, options=conf)
|
||||
|
||||
|
||||
def anonymize(data):
|
||||
"""Anoynimize recieved data."""
|
||||
|
||||
anonym = {}
|
||||
for k in data:
|
||||
if k not in ("ID", "PASSWORD"):
|
||||
anonym[k] = data[k]
|
||||
|
||||
return anonym
|
||||
|
||||
|
||||
def remap_items(entities):
|
||||
"""Remap items in query."""
|
||||
items = {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue