Compare commits

..

5 Commits

Author SHA1 Message Date
FigurinePanda43 f789b754f0
Merge 58b9da9b80 into 3822557f74 2026-02-26 19:07:45 +01:00
Lukas Svoboda 3822557f74
Merge pull request #96 from schizza/fix/push_data_not_accepted
Added support for POST and GET methods in WSLink.
2026-02-26 19:07:16 +01:00
SchiZzA 96094105e0
Added support for POST and GET methods in WSLink.
Some stations sending data in POST method and some in GET method.
We now support both variants.
2026-02-26 18:09:52 +01:00
SchiZzA 6b8fdd5477
Accept push data for WSLink. 2026-02-25 08:30:55 +01:00
SchiZzA b0bae69f33
Update version. 2026-02-23 18:41:58 +01:00
2 changed files with 25 additions and 6 deletions

View File

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

View File

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