Merge remote-tracking branch 'refs/remotes/origin/master'

This commit is contained in:
Wolfgang Hottgenroth
2018-04-02 20:31:18 +02:00
6 changed files with 37 additions and 2 deletions

View File

@ -45,6 +45,21 @@ export function HueColorLightExport(itemId: string, label: string,
brightnessTopic, brightnessFeedbackTopic, hueTopic, hueFeedbackTopic,
saturationTopic, saturationFeedbackTopic, colorTemperatureTopic, colorTemperatureFeedbackTopic), 'openhab': ''}
}
export function RelayBoxExport(stateTopicPre: string, feedbackTopicPre: string, conflictTopicPre: string, itemNames: string[]) : ExportType {
return {'homekit': RelayBoxHomekitExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames),
'openhab': RelayBoxOpenHABExport(stateTopicPre, feedbackTopicPre, conflictTopicPre, itemNames)}
}
function RelayBoxHomekitExport(stateTopicPre: string, feedbackTopicPre: string, conflictTopicPre: string, itemNames: string[]) : HomekitExportType{
return {'id': '', 'object': {}}
}
function RelayBoxOpenHABExport(stateTopicPre: string, feedbackTopicPre: string, conflictTopicPre: string, itemNames: string[]) : string {
return ''
}
function SwitchHomekitBulbExport(id: string, label: string, setOn: string, statusOn: string) : HomekitExportType {
let o : any = {
"id": id,

View File

@ -97,7 +97,7 @@ class MqttHandler {
// sent = this.processMessage(topic, payload)
//}
//if (! sent) {
logger.info(`External sending required: ${topic}`)
logger.info(`External sending required: ${topic} ${payload}`)
let options : IClientPublishOptions = { retain: true, qos: 0 }
this.mqttClient.publish(topic, payload, options)
//} else {

View File

@ -1,6 +1,7 @@
import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AItem } from './AItem'
import { RelayBoxExport, ExportType } from './Export'
@ -31,6 +32,10 @@ export class RelayBoxThing extends AItem {
this.oldSwitchStates = ''
}
exportItem() : ExportType|null {
return RelayBoxExport(this.stateTopicPre, this.feedbackTopicPre, this.conflictTopicPre, this.itemNames)
}
processMessage(topic: string, payload: string) {
// logger.info(`RT: ${topic}, ${payload}`)
if (topic == this.deviceStatusTopic) {