From f0290da391f7c33515e6c0ba12c4d21571999763 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Sun, 1 Jan 2023 10:15:29 +1100 Subject: [PATCH] fix previous_IP --- back/pialert.py | 12 ++++++++++-- docker-compose.yml | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/back/pialert.py b/back/pialert.py index d6b2c7cd..4599f484 100755 --- a/back/pialert.py +++ b/back/pialert.py @@ -816,10 +816,18 @@ def set_dynamic_DNS_IP (): #------------------------------------------------------------------------------- def get_previous_internet_IP (): - # get previos internet IP stored in DB + + previous_IP = '0.0.0.0' + + # get previous internet IP stored in DB openDB() + sql.execute ("SELECT dev_LastIP FROM Devices WHERE dev_MAC = 'Internet' ") - previous_IP = sql.fetchone()[0] + result = sql.fetchone() + + if len(result) > 0: + previous_IP = sql.fetchone()[0] + closeDB() # return previous IP diff --git a/docker-compose.yml b/docker-compose.yml index dbb8206f..082c5fac 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: - ${APP_DATA_LOCATION}/pialert/db/setting_darkmode:/home/pi/pialert/db/setting_darkmode # (optional) useful for debugging if you have issues setting up the container - ${LOGS_LOCATION}:/home/pi/pialert/front/log - # comment out / delete below lines, they are only for development purposes + # DELETE START anyone trying to use this file: comment out / delete BELOW lines, they are only for development purposes - ${DEV_LOCATION}/back/pialert.py:/home/pi/pialert/back/pialert.py - ${DEV_LOCATION}/back/update_vendors.sh:/home/pi/pialert/back/update_vendors.sh - ${DEV_LOCATION}/pholus:/home/pi/pialert/pholus @@ -31,6 +31,7 @@ services: - ${DEV_LOCATION}/front/network.php:/home/pi/pialert/front/network.php - ${DEV_LOCATION}/front/presence.php:/home/pi/pialert/front/presence.php - ${DEV_LOCATION}/front/settings.php:/home/pi/pialert/front/settings.php + # DELETE END anyone trying to use this file: comment out / delete ABOVE lines, they are only for development purposes environment: - TZ=${TZ} - PORT=${PORT}