some changes, not yet done with WindowContact, too cold in Q-West to complete

This commit is contained in:
Wolfgang Hottgenroth
2018-01-15 16:20:59 +01:00
parent 677f9c807d
commit f88cf5ee0d
4 changed files with 104 additions and 11 deletions

View File

@ -2,6 +2,7 @@ import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AItem, HasStateAndFeedbackTopic } from './AItem'
import { SwitchExport, ExportType } from './Export'
import * as http from 'http'
export class UrlSwitchItem extends AItem implements HasStateAndFeedbackTopic {
@ -44,9 +45,9 @@ export class UrlSwitchItem extends AItem implements HasStateAndFeedbackTopic {
mqttHandler.send(this.stateFeedbackTopic, this.state);
if (this.state != this.oldState) {
if (this.state == 'ON') {
mqttHandler.send(this.actionTopic, this.onCode);
http.get(this.onUrl)
} else {
mqttHandler.send(this.actionTopic, this.offCode);
http.get(this.offUrl)
}
this.oldState = this.state;
}