mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-21 22:48:16 +01:00
Minor fixes
- onewire is not hardcoded to busmaster 1 - try to catch exception while sending data to WS and WS has closed connection
This commit is contained in:
parent
7ad3fd252e
commit
8320853399
3 changed files with 8 additions and 5 deletions
|
@ -1,2 +1 @@
|
|||
__version__ = "4.0.1.3"
|
||||
|
||||
__version__ = "4.0.1.4"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue