various ota fixes
This commit is contained in:
parent
c18abb1b8c
commit
ac6f154f06
2 changed files with 4 additions and 4 deletions
|
@ -257,7 +257,7 @@ class MeshConsumer(AsyncWebsocketConsumer):
|
||||||
node_status.ota_recipient.status = OTARecipientStatus.FAILED
|
node_status.ota_recipient.status = OTARecipientStatus.FAILED
|
||||||
await node_status.ota_recipient.send_status()
|
await node_status.ota_recipient.send_status()
|
||||||
await OTAUpdateRecipient.objects.filter(pk=node_status.ota_recipient.pk).aupdate(
|
await OTAUpdateRecipient.objects.filter(pk=node_status.ota_recipient.pk).aupdate(
|
||||||
status=OTARecipientStatus.SUCCESS
|
status=OTARecipientStatus.FAILED
|
||||||
)
|
)
|
||||||
node_status.ota_recipient = None
|
node_status.ota_recipient = None
|
||||||
else:
|
else:
|
||||||
|
@ -337,7 +337,7 @@ class MeshConsumer(AsyncWebsocketConsumer):
|
||||||
await self.send_msg(MeshMessage.fromjson(data["msg"]), data["sender"])
|
await self.send_msg(MeshMessage.fromjson(data["msg"]), data["sender"])
|
||||||
|
|
||||||
async def mesh_ota_recipients_changed(self, data):
|
async def mesh_ota_recipients_changed(self, data):
|
||||||
addresses = set(data["addresses"]) - set(self.dst_nodes.keys())
|
addresses = set(data["addresses"]) & set(self.dst_nodes.keys())
|
||||||
print('recipients changed!')
|
print('recipients changed!')
|
||||||
if not addresses:
|
if not addresses:
|
||||||
print('but none of ours')
|
print('but none of ours')
|
||||||
|
@ -662,7 +662,7 @@ class MeshUIConsumer(AsyncJsonWebsocketConsumer):
|
||||||
await OTAUpdateRecipient.objects.filter(pk=recipient.pk).aupdate(
|
await OTAUpdateRecipient.objects.filter(pk=recipient.pk).aupdate(
|
||||||
status=OTARecipientStatus.CANCELED
|
status=OTARecipientStatus.CANCELED
|
||||||
)
|
)
|
||||||
self.channel_layer.group_send(MESH_ALL_OTA_GROUP, {
|
await self.channel_layer.group_send(MESH_ALL_OTA_GROUP, {
|
||||||
"type": "mesh.ota_recipients_changed",
|
"type": "mesh.ota_recipients_changed",
|
||||||
"addresses": [recipient.node_id]
|
"addresses": [recipient.node_id]
|
||||||
})
|
})
|
||||||
|
|
|
@ -518,7 +518,7 @@ class OTAUpdateRecipient(models.Model):
|
||||||
"""
|
"""
|
||||||
use this for OTA stuffs
|
use this for OTA stuffs
|
||||||
"""
|
"""
|
||||||
channels.layers.get_channel_layer().group_send(MESH_ALL_OTA_GROUP, self.get_status_json())
|
await channels.layers.get_channel_layer().group_send(MESH_ALL_OTA_GROUP, self.get_status_json())
|
||||||
|
|
||||||
def get_status_json(self):
|
def get_status_json(self):
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue