rearrange start to use asyncio
Create an asyncio loop then start confservers, mqtt, and mqtthelper in loop. TODO: Re-work xmpp for asyncio
This commit is contained in:
parent
d5449961f3
commit
a296f038a7
3 changed files with 48 additions and 13 deletions
|
|
@ -73,6 +73,10 @@ class MQTTHelperBot:
|
|||
async def start_helper_bot(self):
|
||||
|
||||
try:
|
||||
self.Client = MQTTClient(
|
||||
client_id=self.client_id, config={"check_hostname": False}
|
||||
)
|
||||
|
||||
await self.Client.connect(
|
||||
"mqtts://{}:{}/".format(self.address[0], self.address[1]),
|
||||
cafile=bumper.ca_cert,
|
||||
|
|
@ -84,6 +88,8 @@ class MQTTHelperBot:
|
|||
]
|
||||
)
|
||||
|
||||
asyncio.ensure_future(self.get_msg())
|
||||
|
||||
except Exception as e:
|
||||
helperbotlog.exception("{}".format(e))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue