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.fix/push_data_not_accepted
parent
6b8fdd5477
commit
96094105e0
|
|
@ -163,7 +163,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_post(
|
wslink_route = hass.http.app.router.add_get(
|
||||||
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,6 +171,14 @@ 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,
|
||||||
|
|
@ -181,6 +189,10 @@ 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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue