lot of changes for first actual use

This commit is contained in:
Wolfgang Hottgenroth
2017-08-23 15:52:37 +02:00
parent 16313c868f
commit 3797d84b4d
14 changed files with 250 additions and 81 deletions

View File

@ -3,23 +3,20 @@ import * as mqtt from './mqttdispatcher'
import * as callchain from './callchain'
import * as plugintest1 from './plugintest1'
import * as EspThermToJson from './espthermtojson'
import * as MongoSave from './mongosave'
log.info("Dispatcher starting")
export const dispatcher = new mqtt.MqttDispatcher()
dispatcher.register('IoT/test', 'print1', (message: any) : any => {
log.info("Callback for IoT/test")
log.info(`message is ${message}`)
return `<<${message}>>`
})
dispatcher.register('IoT/test', 'print2', (message: any) : any => {
log.info("Callback for IoT/test")
log.info(`message is ${message}`)
return `<<${message}>>`
})
dispatcher.register('IoT/test', 'null1', mqtt.passThrough)
dispatcher.register('IoT/test', 'null2', mqtt.passThrough)
let dispatcher = new mqtt.MqttDispatcher("mqtts://broker.hottis.de:8883",
"wn", "locutus", "/home/wn/server-ca.crt")
plugintest1.pluginTest1Start(dispatcher)
dispatcher.register('IoT/espThermometer2/#', 'toJson', EspThermToJson.espThermToJson)
let mongo : MongoSave.MongoSave = new MongoSave.MongoSave()
dispatcher.register('IoT/espThermometer2/#', 'MongoSave', mongo);
// plugintest1.pluginTest1Start(dispatcher)
dispatcher.exec()
log.info("Dispatcher running")