From acc38950e7480b88f104f0f773fba539c24ce48e Mon Sep 17 00:00:00 2001 From: katsu <0xemmilia@gmail.com> Date: Thu, 26 Jun 2025 14:14:19 +0200 Subject: [PATCH] minor changes and fixes, adjusted frontend --- ansible_deploy/malinca.yml | 4 +- ansible_deploy/playbook.yaml | 53 ++------------ barco_telnet/barco_G62_control.py | 25 ++++--- frontend/vju_display/src/App.vue | 18 +++-- .../src/components/LectureModule.vue | 20 ++--- .../components/MasterPowerControlModule.vue | 4 +- .../src/components/pages/LightingPage.vue | 5 +- .../src/components/pages/MainPage.vue | 2 - lucke/luckeControl.py | 6 +- projector_motors/projector_motors.py | 10 +-- tse_serial/tse_serial_controler.py | 73 +++++++++++-------- 11 files changed, 99 insertions(+), 121 deletions(-) diff --git a/ansible_deploy/malinca.yml b/ansible_deploy/malinca.yml index 5da5d35..edf453a 100644 --- a/ansible_deploy/malinca.yml +++ b/ansible_deploy/malinca.yml @@ -1,7 +1,7 @@ P01: hosts: - 10.32.50.170: - #192.168.192.42 + #10.32.50.170: + 192.168.192.42 vars: static_ip: 192.168.192.42 static_mask: 24 diff --git a/ansible_deploy/playbook.yaml b/ansible_deploy/playbook.yaml index 7009b78..8c4fbc1 100644 --- a/ansible_deploy/playbook.yaml +++ b/ansible_deploy/playbook.yaml @@ -101,7 +101,7 @@ become: true ansible.builtin.systemd_service: name: mosquitto.service - state: started + state: restarted daemon_reload: true @@ -121,7 +121,7 @@ ansible.builtin.systemd_service: name: "{{item}}" enabled: true - state: started + state: restarted loop: - barco@main.service - barco@side.service @@ -139,7 +139,7 @@ ansible.builtin.systemd_service: name: projector_motors.service enabled: true - state: started + state: restarted - name: template tse serial box service when: tse_box is defined @@ -154,7 +154,7 @@ ansible.builtin.systemd_service: name: tse_box.service enabled: true - state: started + state: restarted - name: template lucke service when: lucke is defined @@ -169,26 +169,7 @@ ansible.builtin.systemd_service: name: lucke.service enabled: true - state: started - - - - # - name: Copy barco config - # become: true - # ansible.builtin.copy: - # #seuser: root - # src: "./{{ item }}" - # dest: /lib/systemd/system - # owner: root - # group: root - # mode: '0644' - # #backup: yes - # loop: - # - barco@.service - # #- extron_audio.service - # # - mqtt_init.service - # - projector_motors.service - # # - tse_box.service + state: restarted @@ -203,14 +184,7 @@ mode: '0644' backup: yes - # - name: set env - # become: true - # ansible.builtin.lineinfile: - # dest: "/etc/environment" - # state: present - # regexp: "^{{ item.key }}=" - # line: "{{ item.key }}={{ item.value }}" - # with_items: "{{ os_environment }}" + - name: copy frontend to webroot become: true @@ -227,18 +201,3 @@ mode: '0755' backup: yes - # - name: enable modules - # become: true - # ansible.builtin.systemd_service: - # #name: "{{[ 'barco@main.service', 'barco@side.service' ]}}" - # name: "{{ item }}" - # state: stopped - # enabled: false - # loop: - # - barco@main.service - # - barco@side.service - # # - extron_audio.service - # # - mqtt_init.service - # - projector_motors.service - # # - tse_box.service - diff --git a/barco_telnet/barco_G62_control.py b/barco_telnet/barco_G62_control.py index 8e4cad5..c3cd2b2 100644 --- a/barco_telnet/barco_G62_control.py +++ b/barco_telnet/barco_G62_control.py @@ -7,12 +7,12 @@ import sys #GLOBALS -room = "undefined" -position = "glavni" -barcoIP = "undefined" -telnetPort = 3023 -mqttPort = 1883 -mqttIP = 'localhost' +room: str +barcoPosition: str +barcoIP: str +telnetPort: int +mqttPort: int +mqttIP: str cmdMap = { 'power': 'POWR', @@ -23,11 +23,11 @@ reverseCmdMap = {v: k for k, v in cmdMap.items()} def parse_barco_response(raw: str): - global room, position + global room, barcoPosition raw = raw[1:-1] # strip square brackets #print(raw) if raw.startswith("ERR"): - print("Projector" + room + " " + position + " returned" + raw) + print("Projector" + room + " " + barcoPosition + " 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) @@ -40,7 +40,7 @@ async def barco_telnet_command(client, writer, select: str): global room onSub = f"{room}/projectors/{select}/#" #print('TEST', onSub) - onMatch = f"{room}/projectors/{select}/command/+" + onMatch = f"{room}/projectors/{select}/command/+" #TODO should be set? await client.subscribe(onSub) #async with client.messages as msgs: async for mesg in client.messages: @@ -66,7 +66,7 @@ async def barco_telnet_read_status(client, reader, select: str): raw_response: str = output.decode().strip() # strip not necessary? needed for local netcat testing though print("Received: " + raw_response + " from Barco (" + select + ')') parsed = parse_barco_response(raw_response) - if parsed == None: + if parsed is None: continue #TODO alert for errors print(f"Updating topic [{parsed[0]}] with value [{parsed[1]}]") await client.publish(f"{room}/projectors/{select}/status/{parsed[0]}", payload=parsed[1]) @@ -79,7 +79,7 @@ async def barco_telnet_query_status(writer, select: str): writer.write(f"[{val}?]" + '\r\n') # TODO test if funny CRLF necessary (it probably gets ignored) 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(30) # TODO find appropriate period + await asyncio.sleep(10) # TODO find appropriate period # async def shell(reader, writer): @@ -102,8 +102,11 @@ async def main(): g62Barcos = {k: v for k,v in conf["barco_G62"].items()} currentBarco = g62Barcos[barcoPosition] barcoIP = currentBarco['ip'] + telnetPort = currentBarco["port"] room = conf["global"]["room"] + mqttPort = conf["global"]["mqttPort"] + mqttIP = conf["global"]["mqttIp"] barcoReader, barcoWriter = await telnetlib3.open_connection(barcoIP, telnetPort) async with aiomqtt.Client(mqttIP, mqttPort) as client: diff --git a/frontend/vju_display/src/App.vue b/frontend/vju_display/src/App.vue index 1c25081..724acdf 100644 --- a/frontend/vju_display/src/App.vue +++ b/frontend/vju_display/src/App.vue @@ -27,9 +27,12 @@ function lockServicePage() { } + +//TODO display none namest uno