The file modified is types.py in /opt/alarmdecoder-webapp/ad2web/notifications/
Step 1) back up the original module as a failsafe by copying it to types.py.org
Step 2) add
- Code: Select all
import datetime
Step 3) find the following section of code and add the bit between the modification comments (it should take up only one line in the file; use space key before text to align it as seen below):
- Code: Select all
def send(self, type, **kwargs):
errors = []
for id, n in self._notifiers.iteritems():
if n and n.subscribes_to(type, **kwargs):
try:
message = self._build_message(type, **kwargs)
if message:
#modification ->
message = message + " [" + datetime.datetime.now().strftime("%I:%M:%S%p %Z %a %m/%d/%y") + "]"
#modification <-
if n.delay > 0 and type in (ZONE_FAULT, ZONE_RESTORE, BYPASS):
Step 4) reboot the machine running the web app.
It should just work after that and will append "<message text> [hh:mm:ssAM|PM Dow mm/dd/yy]". The %Z was to insert the time zone, but that apparently isn't defined in the AD python raspberry Pi image implementation - or I missed something obvious as I'm new to python - and so doesn't appear.