send_command json instead of str
send_command json instead of str
This commit is contained in:
parent
e873e22fd3
commit
e233fe933e
2 changed files with 61 additions and 10 deletions
|
|
@ -183,9 +183,16 @@ class MQTTHelperBot:
|
|||
cmdjson["payloadType"],
|
||||
)
|
||||
try:
|
||||
await self.Client.publish(
|
||||
ttopic, str(cmdjson["payload"]).encode(), QOS_0
|
||||
)
|
||||
if cmdjson["toType"] == "x":
|
||||
await self.Client.publish(
|
||||
ttopic, str(cmdjson["payload"]).encode(), QOS_0
|
||||
)
|
||||
|
||||
if cmdjson["toType"] == "j":
|
||||
await self.Client.publish(
|
||||
ttopic, json.dumps(cmdjson["payload"]).encode(), QOS_0
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
helperbotlog.exception("{}".format(e))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue