minor changes and fixes, adjusted frontend
This commit is contained in:
parent
d00651a66c
commit
acc38950e7
11 changed files with 99 additions and 121 deletions
|
@ -16,7 +16,7 @@ import toml
|
|||
|
||||
#relays = [LED(17), LED(27), LED(22), LED(23), LED(5), LED(6), LED(24), LED(25)]
|
||||
main_I2C_addr = 0 #default
|
||||
side_I2C_addr = 0
|
||||
side_I2C_addr = 0 #TODO get actual projector motor things from config (dont hardcode main/side)
|
||||
room = ""
|
||||
use_offset = False
|
||||
|
||||
|
@ -90,15 +90,15 @@ async def task_command2relays(controlClient: aiomqtt.Client):
|
|||
msgs = controlClient.messages
|
||||
async for mesg in msgs:
|
||||
mesg: aiomqtt.Message
|
||||
if mesg.topic.matches(f'{room}/projectors/+/lift/move/#'):
|
||||
if mesg.topic.matches(f'{room}/projectors/+/lift/move/+'):
|
||||
msgTopicArr = mesg.topic.value.split('/')
|
||||
state = mesg.payload.decode()
|
||||
print("Received: " + str(msgTopicArr) + " payload: [" + state + "]")
|
||||
#testCase = (msgTopicArr[2], msgTopicArr[4])
|
||||
projSel = msgTopicArr[2]
|
||||
projSel = msgTopicArr[2] #TODO projselect odzadaj indexed (just works tm)
|
||||
if projSel != 'main' and projSel != 'side':
|
||||
continue #TODO error hnadling?
|
||||
command = msgTopicArr[5]
|
||||
command = msgTopicArr[5] #TODO same
|
||||
await msgRelayBoard(projSel, command, state == '1')
|
||||
await controlClient.publish(f'{room}/projectors/{projSel}/lift/status', payload="", qos=1, retain=True)
|
||||
#print("Pushing \'off\' to other relays to prevent conflicts")
|
||||
|
@ -113,7 +113,7 @@ async def main():
|
|||
mainMotor = projMotors.get("main")
|
||||
sideMotor = projMotors.get("side")
|
||||
main_I2C_addr = mainMotor['i2c_address']
|
||||
side_I2C_addr = sideMotor['i2c_address']
|
||||
side_I2C_addr = sideMotor['i2c_address'] #TODO spremen v dict
|
||||
|
||||
room = conf["global"]["room"]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue