From f444400d47d13d291ae3597b2e2c417177356d5c Mon Sep 17 00:00:00 2001 From: Jacek Brzozowski Date: Sat, 20 Sep 2025 21:01:36 +0200 Subject: [PATCH] small fix --- main.py | 23 ++++++++++++----------- templates/settings.html | 6 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index f99c9ec..fa82dff 100644 --- a/main.py +++ b/main.py @@ -192,17 +192,18 @@ loadconfig() def hpiapp(function='status'): if function == 'status': - if not sio_remote.connected: - try: - logging.info("Trying to reconnect...") - sio_remote.connect(SERVER_URL, headers=custom_headers, wait_timeout=10) - except Exception as e: - logging.error(f"Reconnect failed: {e}") - else: - try: - sio_remote.emit("heartbeat", {"token": TOKEN}) - except Exception as e: - logging.warning(f"Emit failed: {e}") + if hpiatstart == '1': + if not sio_remote.connected: + try: + logging.info("Trying to reconnect...") + sio_remote.connect(SERVER_URL, headers=custom_headers, wait_timeout=10) + except Exception as e: + logging.error(f"Reconnect failed: {e}") + else: + try: + sio_remote.emit("heartbeat", {"token": TOKEN}) + except Exception as e: + logging.warning(f"Emit failed: {e}") status=sio_remote.sid ischanged('hpiconn', status) diff --git a/templates/settings.html b/templates/settings.html index 93597f3..c490995 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -1082,9 +1082,9 @@ $(document).ready(function() { $("#hpicontrol")[0].classList.remove('disabled') $("#hpicontrol")[0].classList.add('btn-outline-success') $("#hpicontrol").text('Connect') - if (!$('#hpikey').val()) { - $("#hpicontrol")[0].classList.add('disabled') - } + //if (!$('#hpikey').val()) { + // $("#hpicontrol")[0].classList.add('disabled') + //} break; case false: removeClassesByPrefix('#hpistatus', 'text-')