start with support for TwoLedSignal
This commit is contained in:
@ -12,6 +12,10 @@ export interface HasStateAndFeedbackTopic extends HasStateTopic {
|
|||||||
getStateFeedbackTopic() : string
|
getStateFeedbackTopic() : string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface HasFeedbackTopic {
|
||||||
|
getStateFeedbackTopic() : string
|
||||||
|
}
|
||||||
|
|
||||||
export interface HasInTopic {
|
export interface HasInTopic {
|
||||||
getInTopic() : string
|
getInTopic() : string
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,9 @@ import { mqttHandler } from './MqttDispatcher'
|
|||||||
import { AHomegearItem } from './AHomegearItem'
|
import { AHomegearItem } from './AHomegearItem'
|
||||||
import { ContactExport, ExportType } from './Export'
|
import { ContactExport, ExportType } from './Export'
|
||||||
import { Disabler } from './Disabler'
|
import { Disabler } from './Disabler'
|
||||||
|
import { HasFeedbackTopic } from './AItem'
|
||||||
|
|
||||||
export class MaxWindowContact extends AHomegearItem implements Disabler {
|
export class MaxWindowContact extends AHomegearItem implements Disabler, HasFeedbackTopic {
|
||||||
private deviceFeedbackTopic: string
|
private deviceFeedbackTopic: string
|
||||||
private stateFeedbackTopic: string
|
private stateFeedbackTopic: string
|
||||||
private stateTopic: string
|
private stateTopic: string
|
||||||
|
38
src/TwoLedSignal.ts
Normal file
38
src/TwoLedSignal.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import { AItem, HasFeedbackTopic } from './AItem'
|
||||||
|
|
||||||
|
export class HeatingScene extends AItem {
|
||||||
|
private led1Topics: string[] = []
|
||||||
|
private led2Topics: string[] = []
|
||||||
|
private led1GreenToken: string
|
||||||
|
private led1RedToken: string
|
||||||
|
private led2GreenToken: string
|
||||||
|
private led2RedToken: string
|
||||||
|
|
||||||
|
constructor(floor: string, room: string, item: string, label: string,
|
||||||
|
led1Items: HasFeedbackTopic[], led1GreenToken: string, led1RedToken: string,
|
||||||
|
led2Items: HasFeedbackTopic[], led2GreenToken: string, led2RedToken: string) {
|
||||||
|
|
||||||
|
super(floor, room, item, label)
|
||||||
|
|
||||||
|
this.subscribeTopics = []
|
||||||
|
led1Items.forEach((item: HasFeedbackTopic) => {
|
||||||
|
this.led1Topics.push(item.getStateFeedbackTopic())
|
||||||
|
this.subscribeTopics.push(item.getStateFeedbackTopic())
|
||||||
|
})
|
||||||
|
led2Items.forEach((item: HasFeedbackTopic) => {
|
||||||
|
this.led2Topics.push(item.getStateFeedbackTopic())
|
||||||
|
this.subscribeTopics.push(item.getStateFeedbackTopic())
|
||||||
|
})
|
||||||
|
|
||||||
|
this.led1GreenToken = led1GreenToken
|
||||||
|
this.led1RedToken = led1RedToken
|
||||||
|
this.led2GreenToken = led2GreenToken
|
||||||
|
this.led2RedToken = led2RedToken
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
processMessage(topic: string, payload: string) : void {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
17
src/main.ts
17
src/main.ts
@ -4,7 +4,7 @@ import * as config from './config'
|
|||||||
import * as logger from './log'
|
import * as logger from './log'
|
||||||
import { mqttHandler } from './MqttDispatcher'
|
import { mqttHandler } from './MqttDispatcher'
|
||||||
|
|
||||||
import { AItem, HasInTopic } from './AItem'
|
import { AItem, HasInTopic, HasFeedbackTopic, HasStateAndFeedbackTopic } from './AItem'
|
||||||
import { HomekitExportType, ExportType } from './Export'
|
import { HomekitExportType, ExportType } from './Export'
|
||||||
import { M433SwitchItem } from './M433SwitchItem'
|
import { M433SwitchItem } from './M433SwitchItem'
|
||||||
import { HomematicFourButtonThing, HomematicFourButtonSingleItem } from './HomematicFourButtonThing'
|
import { HomematicFourButtonThing, HomematicFourButtonSingleItem } from './HomematicFourButtonThing'
|
||||||
@ -29,6 +29,8 @@ logger.info("Dispatcher starting")
|
|||||||
|
|
||||||
let allLabeledItems : Array<AItem> = new Array()
|
let allLabeledItems : Array<AItem> = new Array()
|
||||||
let allThermostatItems : Array<HasInTopic> = new Array()
|
let allThermostatItems : Array<HasInTopic> = new Array()
|
||||||
|
let allWindows : Array<HasFeedbackTopic> = new Array()
|
||||||
|
|
||||||
|
|
||||||
// Anna -----------------------------------------------------------------------------------------------------
|
// Anna -----------------------------------------------------------------------------------------------------
|
||||||
// Anna Aquarium 14665044 24 1 14665041 24 1
|
// Anna Aquarium 14665044 24 1 14665041 24 1
|
||||||
@ -56,6 +58,7 @@ allLabeledItems.push(annaBedLight)
|
|||||||
let windowContactAnna1st = new MaxWindowContact('1st', 'Anna', 'WindowContact', 'Fenster Anna', 20)
|
let windowContactAnna1st = new MaxWindowContact('1st', 'Anna', 'WindowContact', 'Fenster Anna', 20)
|
||||||
windowContactAnna1st.start()
|
windowContactAnna1st.start()
|
||||||
allLabeledItems.push(windowContactAnna1st)
|
allLabeledItems.push(windowContactAnna1st)
|
||||||
|
allWindows.push(windowContactAnna1st)
|
||||||
|
|
||||||
let thermostatAnna1st = new MaxThermostat('1st', 'Anna', 'Thermostat', 'Thermostat Anna', 21, [windowContactAnna1st])
|
let thermostatAnna1st = new MaxThermostat('1st', 'Anna', 'Thermostat', 'Thermostat Anna', 21, [windowContactAnna1st])
|
||||||
thermostatAnna1st.start()
|
thermostatAnna1st.start()
|
||||||
@ -95,6 +98,9 @@ allLabeledItems.push(matthiasSpeaker)
|
|||||||
let windowContactMatthias = new MaxWindowContact('1st', 'Matthias', 'WindowContact', 'Fenster', 24)
|
let windowContactMatthias = new MaxWindowContact('1st', 'Matthias', 'WindowContact', 'Fenster', 24)
|
||||||
windowContactMatthias.start()
|
windowContactMatthias.start()
|
||||||
allLabeledItems.push(windowContactMatthias)
|
allLabeledItems.push(windowContactMatthias)
|
||||||
|
allWindows.push(windowContactMatthias)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Esszimmer ------------------------------------------------------------------------------------------------
|
// Esszimmer ------------------------------------------------------------------------------------------------
|
||||||
// Esszimmer kleine Lampe 69653 24 1 69652 24 1
|
// Esszimmer kleine Lampe 69653 24 1 69652 24 1
|
||||||
@ -204,12 +210,15 @@ allLabeledItems.push(bedRoomWindowLight)
|
|||||||
let windowContactBedroomStreet1st = new MaxWindowContact('1st', 'Bedroom', 'WindowContactStreet', 'Fenster Schlafzimmer Strasse', 17)
|
let windowContactBedroomStreet1st = new MaxWindowContact('1st', 'Bedroom', 'WindowContactStreet', 'Fenster Schlafzimmer Strasse', 17)
|
||||||
windowContactBedroomStreet1st.start()
|
windowContactBedroomStreet1st.start()
|
||||||
allLabeledItems.push(windowContactBedroomStreet1st)
|
allLabeledItems.push(windowContactBedroomStreet1st)
|
||||||
|
allWindows.push(windowContactBedroomStreet1st)
|
||||||
let windowContact1BedroomGarden1st = new MaxWindowContact('1st', 'Bedroom', 'WindowContact1Garden', 'Fenster Schlafzimmer 1 Garten', 18)
|
let windowContact1BedroomGarden1st = new MaxWindowContact('1st', 'Bedroom', 'WindowContact1Garden', 'Fenster Schlafzimmer 1 Garten', 18)
|
||||||
windowContact1BedroomGarden1st.start()
|
windowContact1BedroomGarden1st.start()
|
||||||
allLabeledItems.push(windowContact1BedroomGarden1st)
|
allLabeledItems.push(windowContact1BedroomGarden1st)
|
||||||
|
allWindows.push(windowContact1BedroomGarden1st)
|
||||||
let windowContact2BedroomGarden1st = new MaxWindowContact('1st', 'Bedroom', 'WindowContact2Garden', 'Fenster Schlafzimmer 2 Garten', 22)
|
let windowContact2BedroomGarden1st = new MaxWindowContact('1st', 'Bedroom', 'WindowContact2Garden', 'Fenster Schlafzimmer 2 Garten', 22)
|
||||||
windowContact2BedroomGarden1st.start()
|
windowContact2BedroomGarden1st.start()
|
||||||
allLabeledItems.push(windowContact2BedroomGarden1st)
|
allLabeledItems.push(windowContact2BedroomGarden1st)
|
||||||
|
allWindows.push(windowContact2BedroomGarden1st)
|
||||||
|
|
||||||
let thermostatBedroom1st = new MaxThermostat('1st', 'Bedroom', 'Thermostat', 'Thermostat Schlafzimmer', 19, [windowContact1BedroomGarden1st, windowContact2BedroomGarden1st, windowContactBedroomStreet1st])
|
let thermostatBedroom1st = new MaxThermostat('1st', 'Bedroom', 'Thermostat', 'Thermostat Schlafzimmer', 19, [windowContact1BedroomGarden1st, windowContact2BedroomGarden1st, windowContactBedroomStreet1st])
|
||||||
thermostatBedroom1st.start()
|
thermostatBedroom1st.start()
|
||||||
@ -274,6 +283,7 @@ allLabeledItems.push(morningLightScene)
|
|||||||
let windowContactBathroomGnd = new MaxWindowContact('Gnd', 'Bathroom', 'WindowContact', 'Fenster Bad unten', 7)
|
let windowContactBathroomGnd = new MaxWindowContact('Gnd', 'Bathroom', 'WindowContact', 'Fenster Bad unten', 7)
|
||||||
windowContactBathroomGnd.start()
|
windowContactBathroomGnd.start()
|
||||||
allLabeledItems.push(windowContactBathroomGnd)
|
allLabeledItems.push(windowContactBathroomGnd)
|
||||||
|
allWindows.push(windowContactBathroomGnd)
|
||||||
|
|
||||||
let thermostatBathroomGnd = new MaxThermostat('Gnd', 'Bathroom', 'Thermostat', 'Thermostat Bad unten', 4, [windowContactBathroomGnd])
|
let thermostatBathroomGnd = new MaxThermostat('Gnd', 'Bathroom', 'Thermostat', 'Thermostat Bad unten', 4, [windowContactBathroomGnd])
|
||||||
thermostatBathroomGnd.start()
|
thermostatBathroomGnd.start()
|
||||||
@ -294,6 +304,7 @@ thermostatBathroomGndCron.start()
|
|||||||
let windowContactBathroom1st = new MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 2)
|
let windowContactBathroom1st = new MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 2)
|
||||||
windowContactBathroom1st.start()
|
windowContactBathroom1st.start()
|
||||||
allLabeledItems.push(windowContactBathroom1st)
|
allLabeledItems.push(windowContactBathroom1st)
|
||||||
|
allWindows.push(windowContactBathroom1st)
|
||||||
|
|
||||||
let thermostatBathroom1st = new MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 3, [windowContactBathroom1st])
|
let thermostatBathroom1st = new MaxThermostat('1st', 'Bathroom', 'Thermostat', 'Thermostat Bad oben', 3, [windowContactBathroom1st])
|
||||||
thermostatBathroom1st.start()
|
thermostatBathroom1st.start()
|
||||||
@ -315,15 +326,19 @@ thermostatBathroom1stCron.start()
|
|||||||
let windowContactKitchen1 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact1', 'Fenster Küche Garten', 11)
|
let windowContactKitchen1 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact1', 'Fenster Küche Garten', 11)
|
||||||
windowContactKitchen1.start()
|
windowContactKitchen1.start()
|
||||||
allLabeledItems.push(windowContactKitchen1)
|
allLabeledItems.push(windowContactKitchen1)
|
||||||
|
allWindows.push(windowContactKitchen1)
|
||||||
let windowContactKitchen2 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact2', 'Fenster Küche Terassentür Garten', 10)
|
let windowContactKitchen2 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact2', 'Fenster Küche Terassentür Garten', 10)
|
||||||
windowContactKitchen2.start()
|
windowContactKitchen2.start()
|
||||||
allLabeledItems.push(windowContactKitchen2)
|
allLabeledItems.push(windowContactKitchen2)
|
||||||
|
allWindows.push(windowContactKitchen2)
|
||||||
let windowContactKitchen3 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact3', 'Fenster Küche Straße 1', 12)
|
let windowContactKitchen3 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact3', 'Fenster Küche Straße 1', 12)
|
||||||
windowContactKitchen3.start()
|
windowContactKitchen3.start()
|
||||||
allLabeledItems.push(windowContactKitchen3)
|
allLabeledItems.push(windowContactKitchen3)
|
||||||
|
allWindows.push(windowContactKitchen3)
|
||||||
let windowContactKitchen4 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact4', 'Fenster Küche Straße 2', 13)
|
let windowContactKitchen4 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact4', 'Fenster Küche Straße 2', 13)
|
||||||
windowContactKitchen4.start()
|
windowContactKitchen4.start()
|
||||||
allLabeledItems.push(windowContactKitchen4)
|
allLabeledItems.push(windowContactKitchen4)
|
||||||
|
allWindows.push(windowContactKitchen4)
|
||||||
|
|
||||||
let thermostatKitchen = new MaxThermostat('Gnd', 'Kitchen', 'Thermostat', 'Thermostat Küche', 14, [
|
let thermostatKitchen = new MaxThermostat('Gnd', 'Kitchen', 'Thermostat', 'Thermostat Küche', 14, [
|
||||||
windowContactKitchen1, windowContactKitchen2, windowContactKitchen3, windowContactKitchen4])
|
windowContactKitchen1, windowContactKitchen2, windowContactKitchen3, windowContactKitchen4])
|
||||||
|
Reference in New Issue
Block a user