added main panel controls that react accordingly to status, TODO: cleanup, add status to lift script
This commit is contained in:
parent
936efa730d
commit
34e8fc9388
9 changed files with 245 additions and 41 deletions
|
@ -70,9 +70,9 @@ async def barco_telnet_query_status(writer, select: str):
|
|||
for val in cmdMap.values():
|
||||
print(f"Querying Barco {select} with: [{val}?]")
|
||||
writer.write(f"[{val}?]" + '\r\n') # TODO test if funny CRLF necessary (it probably gets ignored)
|
||||
await asyncio.sleep(1) # sleep between writes necessary, otherwise it gets confused.
|
||||
await asyncio.sleep(0.2) # sleep between writes necessary, otherwise it gets confused.
|
||||
# simultaneous commands from control could break this? TODO fix later
|
||||
await asyncio.sleep(10) # TODO find appropriate period
|
||||
await asyncio.sleep(30) # TODO find appropriate period
|
||||
|
||||
|
||||
# async def shell(reader, writer):
|
||||
|
@ -85,10 +85,10 @@ async def barco_telnet_query_status(writer, select: str):
|
|||
|
||||
async def main():
|
||||
#conf = toml.load('config.toml')
|
||||
mainBarcoIP = conf[gethostname()]['projektor_glavni']
|
||||
sideBarcoIP = conf[gethostname()]['projektor_stranski']
|
||||
mainReader, mainWriter = await telnetlib3.open_connection(mainBarcoIP, 3023)
|
||||
sideReader, sideWriter = await telnetlib3.open_connection(sideBarcoIP, 3023)
|
||||
# mainBarcoIP = conf[gethostname()]['projektor_glavni']
|
||||
# sideBarcoIP = conf[gethostname()]['projektor_stranski']
|
||||
mainReader, mainWriter = await telnetlib3.open_connection('localhost', 3023)
|
||||
sideReader, sideWriter = await telnetlib3.open_connection('localhost', 3024)
|
||||
async with aiomqtt.Client('localhost', 1883) as client:
|
||||
task_status_query_main = asyncio.create_task(barco_telnet_query_status(mainWriter, 'glavni'))
|
||||
task_status_reader_main = asyncio.create_task(barco_telnet_read_status(client, mainReader, 'glavni'))
|
||||
|
@ -103,13 +103,13 @@ async def main():
|
|||
|
||||
### fuj to, ne tk delat
|
||||
|
||||
if __name__ == '__main__':
|
||||
# if __name__ == '__main__':
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
coro = telnetlib3.open_connection(mainBarcoIP, 3023, shell=shell)
|
||||
coro = telnetlib3.open_connection(mainBarcoIP, 3023, shell=shell)
|
||||
# coro = telnetlib3.open_connection('localhost', 1234, shell=shell)
|
||||
reader, writer = loop.run_until_complete(coro)
|
||||
loop.run_until_complete(writer.protocol.waiter_closed)
|
||||
# loop = asyncio.get_event_loop()
|
||||
# coro = telnetlib3.open_connection(mainBarcoIP, 3023, shell=shell)
|
||||
# coro = telnetlib3.open_connection(mainBarcoIP, 3023, shell=shell)
|
||||
# # coro = telnetlib3.open_connection('localhost', 1234, shell=shell)
|
||||
# reader, writer = loop.run_until_complete(coro)
|
||||
# loop.run_until_complete(writer.protocol.waiter_closed)
|
||||
|
||||
asyncio.run(main())
|
Loading…
Add table
Add a link
Reference in a new issue