small fix
All checks were successful
Budowanie i publikacja paczki Pythona (Multi-Arch) / build-and-package (arm32v6, linux/arm/v6) (push) Successful in 4m14s
Budowanie i publikacja paczki Pythona (Multi-Arch) / build-and-package (arm32v7, linux/arm/v7) (push) Successful in 4m2s

This commit is contained in:
2025-09-20 21:01:36 +02:00
parent 3d44ea934d
commit f444400d47
2 changed files with 15 additions and 14 deletions

23
main.py
View File

@@ -192,17 +192,18 @@ loadconfig()
def hpiapp(function='status'): def hpiapp(function='status'):
if function == 'status': if function == 'status':
if not sio_remote.connected: if hpiatstart == '1':
try: if not sio_remote.connected:
logging.info("Trying to reconnect...") try:
sio_remote.connect(SERVER_URL, headers=custom_headers, wait_timeout=10) logging.info("Trying to reconnect...")
except Exception as e: sio_remote.connect(SERVER_URL, headers=custom_headers, wait_timeout=10)
logging.error(f"Reconnect failed: {e}") except Exception as e:
else: logging.error(f"Reconnect failed: {e}")
try: else:
sio_remote.emit("heartbeat", {"token": TOKEN}) try:
except Exception as e: sio_remote.emit("heartbeat", {"token": TOKEN})
logging.warning(f"Emit failed: {e}") except Exception as e:
logging.warning(f"Emit failed: {e}")
status=sio_remote.sid status=sio_remote.sid
ischanged('hpiconn', status) ischanged('hpiconn', status)

View File

@@ -1082,9 +1082,9 @@ $(document).ready(function() {
$("#hpicontrol")[0].classList.remove('disabled') $("#hpicontrol")[0].classList.remove('disabled')
$("#hpicontrol")[0].classList.add('btn-outline-success') $("#hpicontrol")[0].classList.add('btn-outline-success')
$("#hpicontrol").text('Connect') $("#hpicontrol").text('Connect')
if (!$('#hpikey').val()) { //if (!$('#hpikey').val()) {
$("#hpicontrol")[0].classList.add('disabled') // $("#hpicontrol")[0].classList.add('disabled')
} //}
break; break;
case false: case false:
removeClassesByPrefix('#hpistatus', 'text-') removeClassesByPrefix('#hpistatus', 'text-')