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

@ -7,15 +7,16 @@ from extron_audio_matrix_telnet_interpreter import *
async def extron_audio_telnet_status(client, reader):
while True: #TODO TODO TODO
while True:
output = await reader.readuntil(b']')
raw_response: str = output.decode().strip() # strip not necessary? needed for local netcat testing though
print("Received: " + raw_response + " from Barco")
# EAMValue(action, io_type, line_id, value)
raw_response: str = output.decode().strip()
print("Received: " + raw_response + " from Extron")
parsed = eam_telnet_code_to_field(raw_response)
if parsed == None:
continue # TODO alert for errors
print(f"Updating topic [{parsed[0]}] with value [{parsed[1]}]")
await client.publish(f"p1/projectors/main/status/{parsed[0]}", payload=parsed[1])
#print(f"Updating topic [{parsed[0]}] with value [{parsed[1]}]")
await client.publish(f"p1/audio_matrix/status/test", payload='test')
async def extron_audio_telnet_control(client, writer):

View file

@ -33,6 +33,7 @@ class EAMValue:
def field_to_eam_telnet_code(field: EAMValue) -> str:
_io = str(field.io + field.id)
# cursed conversion to extron speak, this is how it was in the documentation
_val = str(int(float(field.val) * 10) + 2048) if field.act == ActionType.Gain else \
(1 if field.val == "ON" else 0)
return f"\e{field.act}{_io}*{_val}AU\r\n"