DB Maintenance

merge Fork from https://github.com/jokob-sk/Pi.Alert
This commit is contained in:
leiweibau
2022-06-01 19:19:14 +02:00
parent f8b2ddde8b
commit 55fc68eb1b
7 changed files with 258 additions and 8 deletions

View File

@@ -1167,6 +1167,16 @@ def email_reporting ():
print ('\nReporting...')
openDB()
# Disable reporting on events for devices where reporting is disabled based on the MAC address
sql.execute ("""UPDATE Events SET eve_PendingAlertEmail = 0
WHERE eve_PendingAlertEmail = 1 AND eve_MAC IN
(
SELECT dev_MAC FROM Devices WHERE dev_AlertEvents = 0
)""")
# Open text Template
# Open text Template
template_file = open(PIALERT_BACK_PATH + '/report_template.txt', 'r')
mail_text = template_file.read()