updates sio events

- adds disconnect event which marks the DeviceConnection as disconnected
- updates connect event to notify the observer about the new state and set connected to True
This commit is contained in:
Mose Müller 2024-04-04 16:20:31 +02:00
parent ad0fd8e833
commit 5936e7091e

View File

@ -68,6 +68,14 @@ class Client:
ProxyLoader.update_data_service_proxy(
self.proxy, serialized_object=serialized_object
)
serialized_object["type"] = "DeviceConnection"
self.proxy._notify_changed("", loads(serialized_object))
self.proxy._connected = True
@self._sio.event
async def disconnect() -> None:
logger.debug("Disconnected from '%s:%s' ...", self._hostname, self._port)
self.proxy._connected = False
@self._sio.event
async def notify(data: NotifyDict) -> None: