From ab08986ca22c92bc8176bbcdb99c01211ef30704 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 24 May 2018 22:09:35 +0200 Subject: [PATCH] Kellerlicht --- dist/HomematicSwitchItem.js | 7 ++++--- dist/main.js | 8 ++++++++ src/HomematicSwitchItem.ts | 8 +++++--- src/main.ts | 10 ++++++++++ 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/dist/HomematicSwitchItem.js b/dist/HomematicSwitchItem.js index 45b28f3..c55b82e 100644 --- a/dist/HomematicSwitchItem.js +++ b/dist/HomematicSwitchItem.js @@ -10,12 +10,13 @@ class HomematicSwitchItem extends AHomegearItem_1.AHomegearItem { getStateFeedbackTopic() { return this.stateFeedbackTopic; } - constructor(floor, room, item, label, hmId, type = 'bulb') { + constructor(floor, room, item, label, hmId, partId = 1, type = 'bulb') { super(floor, room, item, label, hmId); + this.partId = partId; this.stateTopic = `${this.topicFirstPart}/state`; this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback`; - this.deviceFeedbackTopic = `${this.deviceTopicPre}/1/STATE`; - this.actionTopic = `${this.actionTopicPre}/1/STATE`; + this.deviceFeedbackTopic = `${this.deviceTopicPre}/${this.partId}/STATE`; + this.actionTopic = `${this.actionTopicPre}/${this.partId}/STATE`; this.subscribeTopics = [ this.stateTopic, this.deviceFeedbackTopic diff --git a/dist/main.js b/dist/main.js index 89302a4..235dc13 100644 --- a/dist/main.js +++ b/dist/main.js @@ -363,6 +363,14 @@ let workshopLight = new HomematicSwitchItem_1.HomematicSwitchItem('Base', 'Works workshopLight.start(); allLabeledItems.push(workshopLight); allRelevantLights.push(workshopLight); +let basementSmallLight = new HomematicSwitchItem_1.HomematicSwitchItem('Base', 'Hallway', 'SmallLight', 'Licht Keller einfach', 35, 1); +basementSmallLight.start(); +allLabeledItems.push(basementSmallLight); +allRelevantLights.push(basementSmallLight); +let basementLargeLight = new HomematicSwitchItem_1.HomematicSwitchItem('Base', 'Hallway', 'LargeLight', 'Licht Keller hell', 35, 2); +basementLargeLight.start(); +allLabeledItems.push(basementLargeLight); +allRelevantLights.push(basementLargeLight); // ---------------------------------------------------------------------------------------------------------- let twoLedSignal1 = new TwoLedSignal_1.TwoLedSignal('Gnd', 'Hallway', 'TwoLedSignal1', 'Licht- und Fenster-Anzeiger', allRelevantLights, "OFF", "ON", allWindows, "CLOSED", "OPEN"); twoLedSignal1.start(); diff --git a/src/HomematicSwitchItem.ts b/src/HomematicSwitchItem.ts index ed47a0d..58007d2 100644 --- a/src/HomematicSwitchItem.ts +++ b/src/HomematicSwitchItem.ts @@ -12,6 +12,7 @@ export class HomematicSwitchItem extends AHomegearItem implements HasStateAndFee private stateFeedbackTopic: string private stateTopic: string private type: string + private partId: number getStateTopic() : string { return this.stateTopic @@ -21,12 +22,13 @@ export class HomematicSwitchItem extends AHomegearItem implements HasStateAndFee return this.stateFeedbackTopic } - constructor(floor: string, room: string, item: string, label: string, hmId: number, type: string = 'bulb') { + constructor(floor: string, room: string, item: string, label: string, hmId: number, partId: number = 1, type: string = 'bulb') { super(floor, room, item, label, hmId) + this.partId = partId this.stateTopic = `${this.topicFirstPart}/state` this.stateFeedbackTopic = `${this.topicFirstPart}/state/feedback` - this.deviceFeedbackTopic = `${this.deviceTopicPre}/1/STATE` - this.actionTopic = `${this.actionTopicPre}/1/STATE` + this.deviceFeedbackTopic = `${this.deviceTopicPre}/${this.partId}/STATE` + this.actionTopic = `${this.actionTopicPre}/${this.partId}/STATE` this.subscribeTopics = [ this.stateTopic, this.deviceFeedbackTopic diff --git a/src/main.ts b/src/main.ts index 3975853..d72de21 100644 --- a/src/main.ts +++ b/src/main.ts @@ -454,6 +454,16 @@ workshopLight.start() allLabeledItems.push(workshopLight) allRelevantLights.push(workshopLight) +let basementSmallLight = new HomematicSwitchItem('Base', 'Hallway', 'SmallLight', 'Licht Keller einfach', 35, 1) +basementSmallLight.start() +allLabeledItems.push(basementSmallLight) +allRelevantLights.push(basementSmallLight) + +let basementLargeLight = new HomematicSwitchItem('Base', 'Hallway', 'LargeLight', 'Licht Keller hell', 35, 2) +basementLargeLight.start() +allLabeledItems.push(basementLargeLight) +allRelevantLights.push(basementLargeLight) + // ---------------------------------------------------------------------------------------------------------- let twoLedSignal1 = new TwoLedSignal('Gnd', 'Hallway', 'TwoLedSignal1', 'Licht- und Fenster-Anzeiger',