Voeg GB-data toe aan WhatsApp notificatie

This commit is contained in:
Eddy de Vink 2026-06-22 10:29:04 +02:00
commit c57363fe24

View file

@ -109,14 +109,15 @@ WHATSAPP_API = "http://100.97.199.84:3000/client/sendMessage/EdGpt"
WHATSAPP_CHAT = "31620248011@c.us"
def send_whatsapp_notification(ok, errors):
def send_whatsapp_notification(ok, errors, total_bytes):
if errors == 0:
prefix = "✅"
status = "geen fouten"
else:
prefix = "❌"
status = f"{errors} fout(en)"
body = f"{prefix} Dashcam transfer voltooid: {ok} bestanden overgezet, {status}"
gb = total_bytes / (1024 ** 3)
body = f"{prefix} Dashcam transfer voltooid: {ok} bestanden ({gb:.1f} GB) overgezet, {status}"
payload = {"chatId": WHATSAPP_CHAT, "content": body, "contentType": "string"}
try:
data = json.dumps(payload).encode()
@ -213,7 +214,7 @@ def main():
ok += 1
logging.info("Transfer voltooid: %d ok, %d fouten", ok, errors)
send_whatsapp_notification(ok, errors)
send_whatsapp_notification(ok, errors, total_size)
if __name__ == "__main__":