@@ 1,6 1,7 @@
import configparser
import driver as epd
+from modules.mail import get_unread
from modules.server import is_up
from modules.timestamp import timestamp_str
from modules.weather import get_weather
@@ 24,9 25,6 @@ draw = ImageDraw.Draw(Himage)
draw.line((430, 0, 430, 330), fill=0, width=5)
draw.line((0, 330, 430, 330), fill=0, width=5)
-# Time
-draw.text((440, 0), timestamp_str(), font=font45, fill=0)
-
# Weather
current, daily = get_weather(
config.get("weather", "apikey"),
@@ 49,6 47,26 @@ for name in server:
draw.text((30, y), "{}: {}".format(name, is_up(server[name])), font=font45, fill=0)
y += 70
+y = 0
+# Time
+draw.text((440, y), timestamp_str(), font=font45, fill=0)
+y = +70
+
+# Unread mails
+draw.text(
+ (440, y),
+ "Mail: {}".format(
+ get_unread(
+ config.get("mail", "ip"),
+ config.get("mail", "port"),
+ config.get("mail", "user"),
+ config.get("mail", "password"),
+ )
+ ),
+ font=font45,
+ fill=0,
+)
+
buffer = epd.getbuffer(Himage)
epd.clear()
epd.display(buffer)