Skip to content

Commit

Permalink
Updating
Browse files Browse the repository at this point in the history
  • Loading branch information
woody-apple committed May 30, 2023
1 parent 0522fce commit 66fc926
Show file tree
Hide file tree
Showing 2 changed files with 1,571 additions and 998 deletions.
36 changes: 19 additions & 17 deletions mqtt-rules.js
Expand Up @@ -138,24 +138,26 @@ const disconnectionEvent = function() {
const connectionProcessor = function() {
logging.info(' * Processing bulk connection setup start')

// need to capture everything that comes in, and process it as such
const changedTopics = Object.keys(collectedMQTTTChanges)

if ( !_.isNil(changedTopics) ) {
changedTopics.forEach(topic => {
const message = collectedMQTTTChanges[topic]

global.generateContext(topic, message, function(outTopic, outMessage, context) {
if (_.isNil(outTopic) || _.isNil(outMessage)) {
logging.error(' *** NOT Processing rules for: ' + topic)
logging.error(' outTopic: ' + outTopic)
logging.error(' outMessage: ' + outMessage)
} else {
context['firstRun'] = true
global.changeProcessor(null, context, outTopic, outMessage)
}
if ( !_.isNil(collectedMQTTTChanges) ) {
// need to capture everything that comes in, and process it as such
const changedTopics = Object.keys(collectedMQTTTChanges)

if ( !_.isNil(changedTopics) ) {
changedTopics.forEach(topic => {
const message = collectedMQTTTChanges[topic]

global.generateContext(topic, message, function(outTopic, outMessage, context) {
if (_.isNil(outTopic) || _.isNil(outMessage)) {
logging.error(' *** NOT Processing rules for: ' + topic)
logging.error(' outTopic: ' + outTopic)
logging.error(' outMessage: ' + outMessage)
} else {
context['firstRun'] = true
global.changeProcessor(null, context, outTopic, outMessage)
}
})
})
})
}
}
stopCollectingMQTTChanges()
logging.info(' => Done!')
Expand Down

0 comments on commit 66fc926

Please sign in to comment.