temporary hardcoding of addresses, ready for test

This commit is contained in:
0xEmm 2024-05-21 15:47:01 +02:00
parent 8a3eb2de70
commit b665085833
4 changed files with 14 additions and 7 deletions

View file

@ -30,7 +30,7 @@ async def task_command2serial(controlClient: aiomqtt.Client):
async with controlClient.messages() as msgs:
async for mesg in msgs:
mesg: aiomqtt.Message
if mesg.topic.matches('p1/tseRelays/+/command'):
if mesg.topic.matches('p1/tse_box/+/ukaz'):
msgTopic = mesg.topic.value
cmnd = mesg.payload.decode()
print("Received: [" + msgTopic + "] payload: [" + cmnd + "]")
@ -42,7 +42,7 @@ async def task_command2serial(controlClient: aiomqtt.Client):
await aser.write_async(bytes(setRelay + '\r\n', "ascii"))
publishTopic = f"p1/tseRelays/{relState.relay_id}/status"
publishPayload = "ON" if relState.state else "OFF"
publishPayload = "1" if relState.state else "0"
print("Also publishing topic [" + publishTopic + "] with status [" + publishPayload + "]")
await controlClient.publish(publishTopic, payload=publishPayload)