Compare commits

..

No commits in common. "a6cb121b4a8d3f04661ca48d33f00fcb0871251f" and "5ca0d65cd6d8e42f4b0528d2603c0e732c1233d7" have entirely different histories.

3 changed files with 9 additions and 30 deletions

View File

@ -56,13 +56,10 @@ class WeatherDataUpdateCoordinator(DataUpdateCoordinator):
self.pocasi: PocasiPush = PocasiPush(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: aiohttp.web.Request): async def recieved_data(self, webdata):
"""Handle incoming data query.""" """Handle incoming data query."""
_wslink = self.config_entry.options.get(WSLINK) _wslink = self.config_entry.options.get(WSLINK)
get_data = webdata.query data = webdata.query
post_data = await webdata.post()
data = dict(get_data) | dict(post_data)
response = None response = None
@ -163,7 +160,7 @@ def register_path(
if debug: if debug:
_LOGGER.debug("Default route: %s", default_route) _LOGGER.debug("Default route: %s", default_route)
wslink_route = hass.http.app.router.add_get( wslink_route = hass.http.app.router.add_post(
WSLINK_URL, WSLINK_URL,
coordinator.recieved_data if _wslink else unregistred, coordinator.recieved_data if _wslink else unregistred,
name="weather_wslink_url", name="weather_wslink_url",
@ -171,14 +168,6 @@ def register_path(
if debug: if debug:
_LOGGER.debug("WSLink route: %s", wslink_route) _LOGGER.debug("WSLink route: %s", wslink_route)
wslink_post_route = hass.http.app.router.add_post(
WSLINK_URL,
coordinator.recieved_data if _wslink else unregistred,
name="weather_wslink_post_route_url",
)
if debug:
_LOGGER.debug("WSLink route: %s", wslink_post_route)
routes.add_route( routes.add_route(
DEFAULT_URL, DEFAULT_URL,
default_route, default_route,
@ -189,10 +178,6 @@ def register_path(
WSLINK_URL, wslink_route, coordinator.recieved_data, _wslink WSLINK_URL, wslink_route, coordinator.recieved_data, _wslink
) )
routes.add_route(
WSLINK_URL, wslink_post_route, coordinator.recieved_data, _wslink
)
hass_data["routes"] = routes hass_data["routes"] = routes
except RuntimeError as Ex: # pylint: disable=(broad-except) except RuntimeError as Ex: # pylint: disable=(broad-except)

View File

@ -1,19 +1,15 @@
{ {
"domain": "sws12500", "domain": "sws12500",
"name": "Sencor SWS 12500 Weather Station", "name": "Sencor SWS 12500 Weather Station",
"codeowners": [ "codeowners": ["@schizza"],
"@schizza"
],
"config_flow": true, "config_flow": true,
"dependencies": [ "dependencies": ["http"],
"http"
],
"documentation": "https://github.com/schizza/SWS-12500-custom-component", "documentation": "https://github.com/schizza/SWS-12500-custom-component",
"homekit": {}, "homekit": {},
"iot_class": "local_push", "iot_class": "local_push",
"issue_tracker": "https://github.com/schizza/SWS-12500-custom-component/issues", "issue_tracker": "https://github.com/schizza/SWS-12500-custom-component/issues",
"requirements": [], "requirements": [],
"ssdp": [], "ssdp": [],
"version": "1.8.2", "version": "1.6.9",
"zeroconf": [] "zeroconf": []
} }

View File

@ -139,12 +139,10 @@ class WindyPush:
if "t1solrad" in purged_data: if "t1solrad" in purged_data:
purged_data["solarradiation"] = purged_data.pop("t1solrad") purged_data["solarradiation"] = purged_data.pop("t1solrad")
windy_station_id = (self.config.options.get(WINDY_STATION_ID) or "").strip() windy_station_id = self.config.options.get(WINDY_STATION_ID, "")
windy_station_pw = (self.config.options.get(WINDY_STATION_PW) or "").strip() windy_station_pw = self.config.options.get(WINDY_STATION_PW, "")
# Both values are required. Options can sometimes be None, so normalize to if windy_station_id == "" or windy_station_pw == "":
# empty string and strip whitespace before validating.
if not windy_station_id or not windy_station_pw:
_LOGGER.error( _LOGGER.error(
"Windy ID or PASSWORD is not set correctly. Please reconfigure your WINDY resend credentials. Disabling WINDY resend for now!" "Windy ID or PASSWORD is not set correctly. Please reconfigure your WINDY resend credentials. Disabling WINDY resend for now!"
) )