Skip to content

Commit

Permalink
Updating notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
woody-apple committed Sep 30, 2023
1 parent 5dec243 commit 1a3da52
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ const pushover = require('pushover-notifications')
const utilities = require('./utilities.js')
const logging = require('homeautomation-js-lib/logging.js')

exports.handleNotification = function(name, topic, context, notify_config) {
exports.handleNotification = function (name, topic, context, notify_config) {
if (utilities.dontPublish()) {
return
}
if (utilities.testMode()) {
return
}

logging.debug(' ** notifying: ' + JSON.stringify(notify_config))
logging.info(' ** notifying: ' + JSON.stringify(notify_config))

const baseAppToken = process.env.PUSHOVER_APP_TOKEN
const baseUserToken = process.env.PUSHOVER_USER_TOKEN
var p = new pushover({
user: (notify_config.user ? notify_config.user : baseUserToken),
token: (notify_config.token ? notify_config.token : baseAppToken),
onerror: function(error) {
onerror: function (error) {
logging.error(' pushover error: ', error)
},
update_sounds: true // update the list of sounds every day - will
Expand Down Expand Up @@ -53,7 +53,7 @@ exports.handleNotification = function(name, topic, context, notify_config) {
url_title: notify_config.url_title,
}

p.send(msg, function(err, result) {
p.send(msg, function (err, result) {
var json = notify_config
json.action = 'notify'
json.result = result
Expand All @@ -69,7 +69,7 @@ exports.handleNotification = function(name, topic, context, notify_config) {
})
}

exports.notificationProcessor = function(options, context, rule_name, notify_config, notify_name, callback) { // ISOLATED
exports.notificationProcessor = function (options, context, rule_name, notify_config, notify_name, callback) { // ISOLATED
logging.debug('evaluating for notify: ' + notify_name + ' notify_config: ' + notify_config)
var expression = notify_config.when
const publishExpression = utilities.prepareExpression(utilities.update_topic_for_expression(expression), context)
Expand Down

0 comments on commit 1a3da52

Please sign in to comment.