display current time on default screen

master
Hendrik Schutter 3 months ago
parent 9b948b0820
commit b67ed823c2
  1. 10
      pyLCDinfo.py

@ -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

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close