display current time on default screen

This commit is contained in:
Hendrik Schutter 2022-10-17 17:46:42 +02:00
parent 9b948b0820
commit b67ed823c2
1 changed files with 9 additions and 1 deletions

View File

@ -2,9 +2,10 @@
# -*- coding: utf-8 -*-
""" Author: Hendrik Schutter, mail@hendrikschutter.com
Date of creation: 2022/05/23
Date of last modification: 2022/05/23
Date of last modification: 2022/10/17
"""
from datetime import datetime
from rpi_lcd import LCD
import netifaces as ni
import subprocess
@ -43,6 +44,10 @@ def get_uptime():
return strftime("%H:%M:%S", gmtime(60*60*24))
def get_system_time():
return datetime.now().strftime("%H:%M")
def main():
if len(sys.argv) != 4:
@ -57,6 +62,7 @@ def main():
#print(get_wireguard_state(wireguard_interface))
#print(get_disk_usage(disk_path))
#print(get_uptime())
#print(get_system_time())
lcd.clear()
lcd.text(" Offsite Backup", 1)
@ -94,6 +100,7 @@ def main():
state_ok = True
lcd.clear()
lcd.text(" VPN connected ", 1)
lcd.text(get_system_time().rjust(16-len(get_system_time())), 2, align='left')
time.sleep(10.0)
else:
lcd.backlight(turn_on=False)
@ -117,6 +124,7 @@ def main():
lcd.clear()
lcd.text(" VPN Connected ", 1)
lcd.text(get_system_time().rjust(16-len(get_system_time())), 2, align='left')
time.sleep(40.0) #sleep a lot to idle cpu
#check if wireguard is still connected