diff --git a/CHANGELOG.md b/CHANGELOG.md index 1835947..6964c8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.1.6 + +- Fix update interface state [#145](https://github.com/elad-bar/ha-edgeos/issues/145) + ## 2.1.5 - Handling undefined interface types [#137](https://github.com/elad-bar/ha-edgeos/issues/137) diff --git a/custom_components/edgeos/managers/rest_api.py b/custom_components/edgeos/managers/rest_api.py index cb56207..378d95e 100644 --- a/custom_components/edgeos/managers/rest_api.py +++ b/custom_components/edgeos/managers/rest_api.py @@ -253,11 +253,11 @@ def _get_post_headers(self): return headers - async def _async_post(self, endpoint, data): + async def _async_post(self, endpoint, data, action: str | None = None): result = None try: - url = self._build_endpoint(endpoint) + url = self._build_endpoint(endpoint, action=action) if self._session is not None: headers = self._get_post_headers() @@ -506,7 +506,7 @@ async def set_interface_state( _LOGGER.info(f"Set state of interface {interface.name} to {is_enabled}") modified = False - endpoint = API_DELETE if is_enabled else API_SET + action = API_DELETE if is_enabled else API_SET data = { API_DATA_INTERFACES: { @@ -514,7 +514,7 @@ async def set_interface_state( } } - result_json = await self._async_post(endpoint, data) + result_json = await self._async_post(API_URL_DATA, data, action=action) if result_json is not None: set_response = result_json.get(API_DATA_SAVE.upper(), {}) diff --git a/custom_components/edgeos/manifest.json b/custom_components/edgeos/manifest.json index f64fbe4..0c78b63 100644 --- a/custom_components/edgeos/manifest.json +++ b/custom_components/edgeos/manifest.json @@ -8,5 +8,5 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/elad-bar/ha-edgeos/issues", "requirements": ["aiohttp"], - "version": "2.1.5" + "version": "2.1.6" }