mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-28 17:54:15 +01:00
actor update api for WS
This commit is contained in:
parent
9c6ede13f1
commit
ac3c880523
3 changed files with 24 additions and 1 deletions
|
@ -1,3 +1,3 @@
|
||||||
__version__ = "4.0.7.a3"
|
__version__ = "4.0.7.a4"
|
||||||
__codename__ = "Spring Break"
|
__codename__ = "Spring Break"
|
||||||
|
|
||||||
|
|
|
@ -66,3 +66,11 @@ class ActorController(BasicController):
|
||||||
self.cbpi.push_update("cbpi/actorupdate/{}".format(id), item.to_dict())
|
self.cbpi.push_update("cbpi/actorupdate/{}".format(id), item.to_dict())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("Failed to update Actor {} {}".format(id, e))
|
logging.error("Failed to update Actor {} {}".format(id, e))
|
||||||
|
|
||||||
|
async def ws_actor_update(self):
|
||||||
|
try:
|
||||||
|
#await self.push_udpate()
|
||||||
|
self.cbpi.ws.send(dict(topic=self.update_key, data=list(map(lambda x: x.to_dict(), self.data))),self.sorting)
|
||||||
|
# self.cbpi.push_update("cbpi/actorupdate/{}".format(id), item.to_dict())
|
||||||
|
except Exception as e:
|
||||||
|
logging.error("Failed to update Actors {}".format(e))
|
|
@ -24,6 +24,21 @@ class ActorHttpEndpoints():
|
||||||
"""
|
"""
|
||||||
return web.json_response(data=self.controller.get_state())
|
return web.json_response(data=self.controller.get_state())
|
||||||
|
|
||||||
|
@request_mapping(path="/ws_update", auth_required=False)
|
||||||
|
async def http_get_all(self, request):
|
||||||
|
"""
|
||||||
|
|
||||||
|
---
|
||||||
|
description: Update WS actors
|
||||||
|
tags:
|
||||||
|
- Actor
|
||||||
|
responses:
|
||||||
|
"204":
|
||||||
|
description: successful operation
|
||||||
|
"""
|
||||||
|
return web.json_response(data=await self.controller.ws_actor_update())
|
||||||
|
|
||||||
|
|
||||||
@request_mapping(path="/{id:\w+}", auth_required=False)
|
@request_mapping(path="/{id:\w+}", auth_required=False)
|
||||||
async def http_get_one(self, request):
|
async def http_get_one(self, request):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue