diff --git a/cbpi/__init__.py b/cbpi/__init__.py index a4d1e04..f1ec938 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1,2 +1 @@ -__version__ = "4.0.1.3" - +__version__ = "4.0.1.4" diff --git a/cbpi/extension/onewire/__init__.py b/cbpi/extension/onewire/__init__.py index 6d1e604..0191354 100644 --- a/cbpi/extension/onewire/__init__.py +++ b/cbpi/extension/onewire/__init__.py @@ -41,7 +41,7 @@ class ReadThread (threading.Thread): try: if self.sensor_name is None: return - with open('/sys/bus/w1/devices/w1_bus_master1/%s/w1_slave' % self.sensor_name, 'r') as content_file: + with open('/sys/bus/w1/devices/%s/w1_slave' % self.sensor_name, 'r') as content_file: content = content_file.read() if (content.split('\n')[0].split(' ')[11] == "YES"): temp = float(content.split("=")[-1]) / 1000 # temp in Celcius diff --git a/cbpi/websocket.py b/cbpi/websocket.py index 253567a..fa6bc5c 100644 --- a/cbpi/websocket.py +++ b/cbpi/websocket.py @@ -32,7 +32,11 @@ class CBPiWebSocket: self.logger.debug("broadcast to ws clients. Data: %s" % data) for ws in self._clients: async def send_data(ws, data): - await ws.send_json(data=data, dumps=json_dumps) + try: + await ws.send_json(data=data, dumps=json_dumps) + except Exception as e: + self.logger.error("Error with client %s: %s" % (ws, str(e))) + self.cbpi.app.loop.create_task(send_data(ws, data)) async def websocket_handler(self, request): @@ -85,4 +89,4 @@ class CBPiWebSocket: self.logger.info("Web Socket Close") return ws - \ No newline at end of file +