reworked relay controls with i2c relay boards, added lift controls to service panel on frontend
This commit is contained in:
parent
ec9c2e818d
commit
936efa730d
12 changed files with 458 additions and 77 deletions
|
@ -7,14 +7,14 @@ from dataclasses import dataclass
|
|||
|
||||
room = 'p01' #TODO make be do get fronm file of configuration
|
||||
|
||||
# aser: aioserial.AioSerial = aioserial.AioSerial(
|
||||
# port='/dev/cu.usbserial-14240', #TODO not hardcode it
|
||||
# baudrate=1200,
|
||||
# parity=serial.PARITY_NONE,
|
||||
# bytesize=serial.EIGHTBITS,
|
||||
# stopbits=serial.STOPBITS_ONE
|
||||
# )
|
||||
# TODO adjust serial on actual TSE interface
|
||||
aser: aioserial.AioSerial = aioserial.AioSerial(
|
||||
port='/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0',
|
||||
#id say not hardcode it ampak kinda nimamo izbire
|
||||
baudrate=1200,
|
||||
parity=serial.PARITY_NONE,
|
||||
bytesize=serial.EIGHTBITS,
|
||||
stopbits=serial.STOPBITS_ONE
|
||||
)
|
||||
|
||||
#TODO get this from file da ni hardcoded
|
||||
|
||||
|
@ -41,9 +41,11 @@ shades_mapping = {
|
|||
}
|
||||
|
||||
#reverse_lookup = {v: k for k, v in mapping.items()} #fujto
|
||||
# TODO simple reverse lookup za ko kripa pove kaj
|
||||
|
||||
|
||||
# TODO simple reverse lookup za ko kripa pove kaj
|
||||
# in vse tole
|
||||
|
||||
async def task_status2mqtt(statusClient: aiomqtt.Client):
|
||||
while True:
|
||||
#data = await aser.read_until_async()
|
||||
|
@ -71,7 +73,7 @@ async def executeAndPublish(mqttClient, pubTopic, pubPayload, relStat):
|
|||
print("Sending to TSE box: " + setRelayCmd)
|
||||
print(f"Also publishing topic [{pubTopic}] with status [{pubPayload}]")
|
||||
print()
|
||||
#await aser.write_async(bytes(setRelayCmd + '\r\n', "ascii"))
|
||||
await aser.write_async(bytes(setRelayCmd + '\r\n', "ascii"))
|
||||
await mqttClient.publish(pubTopic, payload=pubPayload)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue