From 370a7d89c58812ac6d59db84c7c66bb8a977c6d8 Mon Sep 17 00:00:00 2001 From: ebelcrom Date: Fri, 6 Mar 2020 18:43:32 +0100 Subject: [PATCH] timestamp in notification message added --- lib/notify.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/notify.js b/lib/notify.js index 0a28a87..9015e8a 100644 --- a/lib/notify.js +++ b/lib/notify.js @@ -4,6 +4,7 @@ const gpio = require('./gpio'); const settings = require('./../init/settings.json'); const fs = require('fs'); const webpush = require('web-push'); +const dateformat = require('dateformat'); var data = { area: null, @@ -67,8 +68,10 @@ function executeNotification(notification) { const icon = 'data:image/png;base64,' + fs.readFileSync(__dirname + '/../public/images/icon.png', 'base64'); + const now = new Date(); + const timestamp = dateformat(now, 'ddd mmm dd yyyy HH:MM:ss Z'); const payload = { - message: 'The garage door is open!', + message: 'The garage door is open!\n' + timestamp, icon: icon }; log.debug('Paylod length:', JSON.stringify(payload).length); -- 2.30.2