Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix async dispatcher send #150

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.1.7

- Fix async dispatcher send

## 2.1.6

- Fix update interface state [#145](https://github.com/elad-bar/ha-edgeos/issues/145)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/edgeos/managers/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_create_clientsession
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.dispatcher import dispatcher_send

from ..common.connectivity_status import ConnectivityStatus
from ..common.consts import (
Expand Down Expand Up @@ -400,7 +400,7 @@ def _async_dispatcher_send(self, signal: str, *args: Any) -> None:
self._local_async_dispatcher_send(signal, None, *args)

else:
async_dispatcher_send(self._hass, signal, self._entry_id, *args)
dispatcher_send(self._hass, signal, self._entry_id, *args)

async def async_send_heartbeat(self, max_age=HEARTBEAT_MAX_AGE):
ts = None
Expand Down
8 changes: 4 additions & 4 deletions custom_components/edgeos/managers/websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_create_clientsession
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.dispatcher import dispatcher_send

from ..common.connectivity_status import ConnectivityStatus
from ..common.consts import (
Expand Down Expand Up @@ -395,15 +395,15 @@ def _set_status(self, status: ConnectivityStatus):
status,
)

def set_local_async_dispatcher_send(self, dispatcher_send):
self._local_async_dispatcher_send = dispatcher_send
def set_local_async_dispatcher_send(self, callback):
self._local_async_dispatcher_send = callback

def _async_dispatcher_send(self, signal: str, *args: Any) -> None:
if self._hass is None:
self._local_async_dispatcher_send(signal, self._entry_id, *args)

else:
async_dispatcher_send(self._hass, signal, self._entry_id, *args)
dispatcher_send(self._hass, signal, self._entry_id, *args)

def _increase_counter(self, key):
counter = self.data.get(key, 0)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/edgeos/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/elad-bar/ha-edgeos/issues",
"requirements": ["aiohttp"],
"version": "2.1.6"
"version": "2.1.7"
}
Loading