introduce interfaces for state/feedback topics

This commit is contained in:
Wolfgang Hottgenroth
2018-01-11 13:52:09 +01:00
parent c7834fefb1
commit 28eec19e53
7 changed files with 92 additions and 54 deletions

View File

@ -4,6 +4,12 @@ const MqttDispatcher_1 = require("./MqttDispatcher");
const AHomematicItem_1 = require("./AHomematicItem");
const Export_1 = require("./Export");
class HomematicSwitchItem extends AHomematicItem_1.AHomematicItem {
getStateTopic() {
return this.stateTopic;
}
getStateFeedbackTopic() {
return this.stateFeedbackTopic;
}
constructor(floor, room, item, label, hmId, type = 'bulb') {
super(floor, room, item, label, hmId);
this.stateTopic = `${this.topicFirstPart}/state`;

View File

@ -4,6 +4,12 @@ const MqttDispatcher_1 = require("./MqttDispatcher");
const AItem_1 = require("./AItem");
const Export_1 = require("./Export");
class M433SwitchItem extends AItem_1.AItem {
getStateTopic() {
return this.stateTopic;
}
getStateFeedbackTopic() {
return this.stateFeedbackTopic;
}
constructor(floor, room, item, label, onCode, offCode, type = 'bulb') {
super(floor, room, item, label);
this.stateTopic = `${this.topicFirstPart}/state`;

50
dist/main.js vendored
View File

@ -102,37 +102,37 @@ bedRoomWindowLight.start();
allLabeledItems.push(bedRoomWindowLight);
// ---------------------------------------------------------------------------------------------------------
let morningLightForwarder = new Forwarder_1.Forwarder('Gnd', 'Hallway', 'MorningLight', 'state', 'MorningLight', [
kitchenWindowLight.stateTopic,
kitchenCeilingLight.stateTopic,
hallwayDeskLight.stateTopic,
hallwayStandLight.stateTopic,
hallwayWardrobeLight.stateTopic
kitchenWindowLight.getStateTopic(),
kitchenCeilingLight.getStateTopic(),
hallwayDeskLight.getStateTopic(),
hallwayStandLight.getStateTopic(),
hallwayWardrobeLight.getStateTopic()
]);
morningLightForwarder.start();
let dayLightForwarder = new Forwarder_1.Forwarder('Gnd', 'Hallway', 'DayLight', 'state', 'DayLight', [
kitchenWindowLight.stateTopic,
kitchenCeilingLight.stateTopic,
hallwayDeskLight.stateTopic,
hallwayStandLight.stateTopic,
hallwayWardrobeLight.stateTopic,
diningRoomSmallLight.stateTopic,
diningRoomStandLight.stateTopic,
diningRoomCupboardLight.stateTopic,
livingRoomLargeLight.stateTopic,
livingRoomSmallLight.stateTopic,
livingRoomStars.stateTopic,
livingRoomStandLight.stateTopic
kitchenWindowLight.getStateTopic(),
kitchenCeilingLight.getStateTopic(),
hallwayDeskLight.getStateTopic(),
hallwayStandLight.getStateTopic(),
hallwayWardrobeLight.getStateTopic(),
diningRoomSmallLight.getStateTopic(),
diningRoomStandLight.getStateTopic(),
diningRoomCupboardLight.getStateTopic(),
livingRoomLargeLight.getStateTopic(),
livingRoomSmallLight.getStateTopic(),
livingRoomStars.getStateTopic(),
livingRoomStandLight.getStateTopic()
]);
dayLightForwarder.start();
let ecoLightForwarder = new Forwarder_1.Forwarder('Gnd', 'Hallway', 'EcoLight', 'state', 'EcoLight', [
kitchenWindowLight.stateTopic,
hallwayDeskLight.stateTopic,
hallwayWardrobeLight.stateTopic,
diningRoomSmallLight.stateTopic,
diningRoomStandLight.stateTopic,
diningRoomCupboardLight.stateTopic,
livingRoomStars.stateTopic,
livingRoomStandLight.stateTopic
kitchenWindowLight.getStateTopic(),
hallwayDeskLight.getStateTopic(),
hallwayWardrobeLight.getStateTopic(),
diningRoomSmallLight.getStateTopic(),
diningRoomStandLight.getStateTopic(),
diningRoomCupboardLight.getStateTopic(),
livingRoomStars.getStateTopic(),
livingRoomStandLight.getStateTopic()
]);
ecoLightForwarder.start();
// ----------------------------------------------------------------------------------------------------------