some changes, not yet done with WindowContact, too cold in Q-West to complete
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user