Skip to content

Commit

Permalink
Notify and User managers updated. New release v2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
npeditto committed Jan 22, 2018
1 parent a571db5 commit 7928973
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/management/mng_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ user_utils.prototype.createUser = function (username, password, email, f_name, l

} else {

response.message = "IoTronic user '" + username + " successfully created!";
response.message = "IoTronic user '" + username + " (id = "+user_id+") successfully created!";
response.result = "SUCCESS";
logger.info("[USER] --> " +response.message);
res.status(200).send(response);
Expand Down
6 changes: 3 additions & 3 deletions lib/management/mng_wamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ var onBoardConnected = function (args) {

var user_email = response.message[0].email;
var subject = 'NOTIFY by Stack4Things BOX '+ label;
var message = "Alarm DEACTIVATED for Stack4Things box '"+label+"': box is online again!";
var message = "Alarm DEACTIVATED for Stack4Things box '"+label+"': box is online again (@ "+utility.getLocalTime()+")";


if (boards_disconnected[board_id]['alert_count'] < response.message[0].notify_retry)
Expand Down Expand Up @@ -490,7 +490,7 @@ var onLeave_function = function (session_id) {
logger.debug("[NOTIFY] - Alarm check ["+boards_disconnected[board]['alert_count']+"]: Board " + board + " - User: "+user + " - Email: "+user_email); //+" - Cache: " + JSON.stringify(boards_disconnected));

var subject = 'ALERT by Stack4Things BOX '+ label;
var message = "Your Stack4Things box '"+label+"' ("+board+") is offline!";
var message = "Your Stack4Things box '"+label+"' ("+board+") is offline (@ "+utility.getLocalTime()+")";
utility.sendEmail(smtpConfig, user_email, subject, message);

}
Expand All @@ -504,7 +504,7 @@ var onLeave_function = function (session_id) {
logger.debug("[NOTIFY] --> Alarm DEACTIVATED for the board '" + board +"': max connection retries reached.");

var subject = 'ALERT by Stack4Things BOX '+ label;
var message = "Max connection retries for Stack4Things box '"+label+"' reached: your box is offline!";
var message = "Max connection retries for Stack4Things box '"+label+"' reached: your box is offline (@ "+utility.getLocalTime()+")";
utility.sendEmail(smtpConfig, user_email, subject, message);


Expand Down
7 changes: 7 additions & 0 deletions lib/management/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,17 @@ var sendEmail = function (smtpConfig, email, subject, message) {

};

var getLocalTime = function (){

var tzoffset = (new Date()).getTimezoneOffset() * 60000; //offset in milliseconds
var localISOTime = (new Date(Date.now() - tzoffset)).toISOString();

return localISOTime

};


module.exports.getLocalTime = getLocalTime;
module.exports.sendEmail = sendEmail;
module.exports.execute = execute;
module.exports.getIP = getIP;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mdslab/iotronic-standalone",
"version": "2.0.1",
"version": "2.0.2",
"description": "IoTronic-standalone is the implementation of a personal Cloud to remote manage embedded devices (Arduino YUN/Linino One, Raspberry Pi 2/3, etc)",
"main": "lib/iotronic_standalone.js",
"scripts": {
Expand Down

0 comments on commit 7928973

Please sign in to comment.