Added lighting preset recall on backend and frontend, fixed things in other scripts - things should *mostly* be working now
This commit is contained in:
parent
61a8aa8ebc
commit
d00651a66c
14 changed files with 851 additions and 74 deletions
|
@ -8,7 +8,7 @@ import sys
|
|||
#GLOBALS
|
||||
|
||||
room = "undefined"
|
||||
position = "undefined"
|
||||
position = "glavni"
|
||||
barcoIP = "undefined"
|
||||
telnetPort = 3023
|
||||
mqttPort = 1883
|
||||
|
@ -23,9 +23,11 @@ reverseCmdMap = {v: k for k, v in cmdMap.items()}
|
|||
|
||||
|
||||
def parse_barco_response(raw: str):
|
||||
global room, position
|
||||
raw = raw[1:-1] # strip square brackets
|
||||
#print(raw)
|
||||
if raw.startswith("ERR"):
|
||||
print("Projector" + room + " " + position + " returned" + raw)
|
||||
return None # TODO parse type error - "disabled control" is special case which shouldnt normally happen
|
||||
cmd, status = raw.split("!", maxsplit=2)
|
||||
#print(cmd + " " + status)
|
||||
|
@ -33,7 +35,6 @@ def parse_barco_response(raw: str):
|
|||
status = '1' if status == '01' else '0'
|
||||
return cmd, status
|
||||
|
||||
#TODO MAKE THESE USE GLOBAL INSTEAD OF PASSING BARCO POSITION IN MAIN
|
||||
|
||||
async def barco_telnet_command(client, writer, select: str):
|
||||
global room
|
||||
|
@ -90,17 +91,20 @@ async def barco_telnet_query_status(writer, select: str):
|
|||
|
||||
|
||||
async def main():
|
||||
global room
|
||||
global barcoPosition, barcoIP, telnetPort, mqttIP, mqttPort
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit("No position provided")
|
||||
else:
|
||||
barcoPosition = sys.argv[1]
|
||||
|
||||
conf = toml.load('./config.toml')
|
||||
g62Barcos = {k: v for k,v in barcos["barco_G62"].items()}
|
||||
currentBarco = newBarcos[barcoPosition]
|
||||
conf = toml.load('./malinaConfig.toml')
|
||||
g62Barcos = {k: v for k,v in conf["barco_G62"].items()}
|
||||
currentBarco = g62Barcos[barcoPosition]
|
||||
barcoIP = currentBarco['ip']
|
||||
|
||||
room = conf["global"]["room"]
|
||||
|
||||
barcoReader, barcoWriter = await telnetlib3.open_connection(barcoIP, telnetPort)
|
||||
async with aiomqtt.Client(mqttIP, mqttPort) as client:
|
||||
task_status_query_barco = asyncio.create_task(barco_telnet_query_status(barcoWriter, barcoPosition))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue