adjust for smartclient output

This commit is contained in:
2018-06-25 13:14:03 +02:00
parent 718ac667d1
commit 28fa32d48d
17 changed files with 842 additions and 401 deletions

View File

@ -13,6 +13,15 @@ export interface HasStateAndFeedbackTopic extends HasStateTopic {
getStateFeedbackTopic() : string
}
export interface HasStateAndFeedbackTopicAndLabel extends HasFeedbackTopic {
getLabel() : string
}
export interface HasStateAndFeedbackTopicAndLabelAndRoom extends HasStateAndFeedbackTopic {
getLabel() : string
getRoom() : string
}
export interface HasFeedbackTopic {
getStateFeedbackTopic() : string
}

View File

@ -2,9 +2,9 @@ import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AHomegearItem } from './AHomegearItem'
import { SwitchExport, ExportType } from './Export'
import { HasStateAndFeedbackTopic } from './AItem';
import { HasStateAndFeedbackTopicAndLabelAndRoom } from './AItem';
export class HomematicSwitchItem extends AHomegearItem implements HasStateAndFeedbackTopic {
export class HomematicSwitchItem extends AHomegearItem implements HasStateAndFeedbackTopicAndLabelAndRoom {
private oldState: string|undefined
private state: string
private actionTopic: string
@ -14,6 +14,14 @@ export class HomematicSwitchItem extends AHomegearItem implements HasStateAndFee
private type: string
private partId: number
getLabel(): string {
return this.label
}
getRoom() : string {
return this.room
}
getStateTopic() : string {
return this.stateTopic
}

View File

@ -2,9 +2,9 @@ import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AHomegearItem } from './AHomegearItem'
import { HueColorLightExport, ExportType } from './Export'
import { HasStateAndFeedbackTopic, HasInTopic } from './AItem'
import { HasStateAndFeedbackTopic, HasInTopic, HasStateAndFeedbackTopicAndLabelAndRoom } from './AItem'
export class HueColorBulbItem extends AHomegearItem implements HasStateAndFeedbackTopic{
export class HueColorBulbItem extends AHomegearItem implements HasStateAndFeedbackTopicAndLabelAndRoom {
private readonly BRIGHT_FACTOR: number = 2.54
private readonly HUE_FACTOR: number = (65535 / 360)
private readonly SATURATION_FACTOR: number = 2.54
@ -34,6 +34,14 @@ export class HueColorBulbItem extends AHomegearItem implements HasStateAndFeedba
private hueDeviceTopic: string
private saturationDeviceTopic: string
getLabel() : string {
return this.label
}
getRoom() : string {
return this.room
}
getStateTopic() : string {
return this.stateTopic
}

View File

@ -1,10 +1,10 @@
import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AItem, HasStateAndFeedbackTopic, HasInTopic } from './AItem'
import { AItem, HasStateAndFeedbackTopicAndLabelAndRoom, HasInTopic, HasStateAndFeedbackTopic } from './AItem'
import { SwitchExport, ExportType } from './Export'
export class M433SwitchItem extends AItem implements HasStateAndFeedbackTopic {
export class M433SwitchItem extends AItem implements HasStateAndFeedbackTopicAndLabelAndRoom {
private offCode: string
private onCode: string
private oldState: string|undefined
@ -14,6 +14,14 @@ export class M433SwitchItem extends AItem implements HasStateAndFeedbackTopic {
private stateTopic: string
private type: string
getLabel() : string {
return this.label
}
getRoom() : string {
return this.room
}
getStateTopic() : string {
return this.stateTopic
}

View File

@ -3,9 +3,9 @@ import { mqttHandler } from './MqttDispatcher'
import { AHomegearItem } from './AHomegearItem'
import { ContactExport, ExportType } from './Export'
import { Disabler } from './Disabler'
import { HasFeedbackTopic } from './AItem'
import { HasFeedbackTopic, HasStateAndFeedbackTopicAndLabel } from './AItem'
export class MaxWindowContact extends AHomegearItem implements Disabler, HasFeedbackTopic {
export class MaxWindowContact extends AHomegearItem implements Disabler, HasStateAndFeedbackTopicAndLabel {
private deviceFeedbackTopic: string
private stateFeedbackTopic: string
private stateTopic: string
@ -15,6 +15,10 @@ export class MaxWindowContact extends AHomegearItem implements Disabler, HasFeed
return this.stateFeedbackTopic
}
getLabel() {
return this.label
}
transform(payload: string) : string {
let res: string
if (payload == 'OPEN') {

View File

@ -1,9 +1,9 @@
import { AItem, HasStateAndFeedbackTopic } from './AItem'
import { AItem, HasStateAndFeedbackTopic, HasStateAndFeedbackTopicAndLabelAndRoom } from './AItem'
import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { ExportType, SwitchExport } from './Export'
export class LightScene extends AItem implements HasStateAndFeedbackTopic {
export class LightScene extends AItem implements HasStateAndFeedbackTopicAndLabelAndRoom {
private onFeedbackTopics: string[]
private offFeedbackTopics: string[]
private onTopics: string[]
@ -17,6 +17,14 @@ export class LightScene extends AItem implements HasStateAndFeedbackTopic {
private onItems: HasStateAndFeedbackTopic[]
private myLastFeedbackState: string
getLabel() {
return this.label
}
getRoom() {
return this.room
}
getStateTopic() {
return this.stateTopic
}

View File

@ -4,7 +4,7 @@ import * as config from './config'
import * as logger from './log'
import { mqttHandler } from './MqttDispatcher'
import { AItem, HasInTopic, HasFeedbackTopic, HasStateAndFeedbackTopic } from './AItem'
import { AItem, HasInTopic, HasFeedbackTopic, HasStateAndFeedbackTopic, HasStateAndFeedbackTopicAndLabelAndRoom, HasStateAndFeedbackTopicAndLabel } from './AItem'
import { HomekitExportType, ExportType } from './Export'
import { M433SwitchItem } from './M433SwitchItem'
import { HomematicFourButtonThing, HomematicFourButtonSingleItem } from './HomematicFourButtonThing'
@ -34,11 +34,11 @@ let allLabeledItems : Array<AItem> = new Array()
let allThermostatItems : Array<HasInTopic> = new Array()
let allWindows : Array<HasFeedbackTopic> = new Array()
let allRelevantLights: Array<HasFeedbackTopic> = new Array()
let allLights: Array<HasStateAndFeedbackTopicAndLabelAndRoom> = new Array();
let allLightScenes: Array<HasStateAndFeedbackTopicAndLabelAndRoom> = new Array();
// Anna -----------------------------------------------------------------------------------------------------
// Anna Aquarium 14665044 24 1 14665041 24 1
let aquariumLight = new M433SwitchItem('1st', 'Anna', 'AquariumLight', 'Aquariumlicht', '14665044 24 1', '14665041 24 1')
let aquariumLight = new M433SwitchItem('1st', 'Anna', 'AquariumLight', 'Aquarium', '14665044 24 1', '14665041 24 1')
aquariumLight.start()
allLabeledItems.push(aquariumLight)
@ -54,12 +54,13 @@ aquariumLightCron.start()
// Anna Bett 14668116 24 1 14668113 24 1
let annaBedLight = new M433SwitchItem('1st', 'Anna', 'BedLight', 'Bettlicht Anna', '14668116 24 1', '14668113 24 1')
let annaBedLight = new M433SwitchItem('1st', 'Anna', 'BedLight', 'Bettlicht', '14668116 24 1', '14668113 24 1')
annaBedLight.start()
allLabeledItems.push(annaBedLight)
allRelevantLights.push(annaBedLight)
allLights.push(annaBedLight)
let windowContactAnna1st = new MaxWindowContact('1st', 'Anna', 'WindowContact', 'Fenster Anna', 20)
let windowContactAnna1st = new MaxWindowContact('1st', 'Anna', 'WindowContact', 'Anna', 20)
windowContactAnna1st.start()
allLabeledItems.push(windowContactAnna1st)
allWindows.push(windowContactAnna1st)
@ -85,25 +86,28 @@ thermostatAnna1stCron.start()
// Matthias -------------------------------------------------------------------------------------------------
// Matthias Stehlampen 7 24 1 6 24 1
let matthiasStandLights = new M433SwitchItem('1st', 'Matthias', 'StandLight', 'Stehlampen Matthias', '7 24 1', '6 24 1')
let matthiasStandLights = new M433SwitchItem('1st', 'Matthias', 'StandLight', 'Stehlampen', '7 24 1', '6 24 1')
matthiasStandLights.start()
allLabeledItems.push(matthiasStandLights)
allRelevantLights.push(matthiasStandLights)
allLights.push(matthiasStandLights)
// Matthias Bett 15 24 1 14 24 1
let matthiasBedLight = new M433SwitchItem('1st', 'Matthias', 'BedLight', 'Bettlicht Matthias', '15 24 1', '14 24 1')
let matthiasBedLight = new M433SwitchItem('1st', 'Matthias', 'BedLight', 'Bettlicht', '15 24 1', '14 24 1')
matthiasBedLight.start()
allLabeledItems.push(matthiasBedLight)
allRelevantLights.push(matthiasBedLight)
allLights.push(matthiasBedLight)
// Matthias Lautsprecher 11 24 1 10 24 1
let matthiasSpeaker = new M433SwitchItem('1st', 'Matthias', 'Speaker', 'Lautsprecher Matthias', '11 24 1', '10 24 1', 'outlet')
let matthiasSpeaker = new M433SwitchItem('1st', 'Matthias', 'Speaker', 'Lautsprecher', '11 24 1', '10 24 1', 'outlet')
matthiasSpeaker.start()
allLabeledItems.push(matthiasSpeaker)
allRelevantLights.push(matthiasSpeaker)
allLights.push(matthiasSpeaker)
let windowContactMatthias = new MaxWindowContact('1st', 'Matthias', 'WindowContact', 'Fenster Matthias', 24)
let windowContactMatthias = new MaxWindowContact('1st', 'Matthias', 'WindowContact', 'Matthias', 24)
windowContactMatthias.start()
allLabeledItems.push(windowContactMatthias)
allWindows.push(windowContactMatthias)
@ -112,44 +116,48 @@ allWindows.push(windowContactMatthias)
// Esszimmer ------------------------------------------------------------------------------------------------
// Esszimmer kleine Lampe 69653 24 1 69652 24 1
let diningRoomSmallLight = new M433SwitchItem('Gnd', 'DiningRoom', 'SmallLight', 'kleine Lampe Esszimmer', '69653 24 1', '69652 24 1')
let diningRoomSmallLight = new M433SwitchItem('Gnd', 'Esszimmer', 'SmallLight', 'kleine Lampe', '69653 24 1', '69652 24 1')
diningRoomSmallLight.start()
allLabeledItems.push(diningRoomSmallLight)
allRelevantLights.push(diningRoomSmallLight)
allLights.push(diningRoomSmallLight)
// Esszimmer Stehlampe 86037 24 1 86036 24 1
let diningRoomStandLight = new M433SwitchItem('Gnd', 'DiningRoom', 'StandLight', 'Stehlampe Esszimmer', '86037 24 1', '86036 24 1')
let diningRoomStandLight = new M433SwitchItem('Gnd', 'Esszimmer', 'StandLight', 'Stehlampe', '86037 24 1', '86036 24 1')
diningRoomStandLight.start()
allLabeledItems.push(diningRoomStandLight)
allRelevantLights.push(diningRoomStandLight)
allLights.push(diningRoomStandLight)
// Esszimmer Schranklicht 65813 24 1 65812 24 1
let diningRoomCupboardLight = new M433SwitchItem('Gnd', 'DiningRoom', 'CupboardLight', 'Schranklicht Esszimmer', '65813 24 1', '65812 24 1')
let diningRoomCupboardLight = new M433SwitchItem('Gnd', 'Esszimmer', 'CupboardLight', 'Schranklicht', '65813 24 1', '65812 24 1')
diningRoomCupboardLight.start()
allLabeledItems.push(diningRoomCupboardLight)
allRelevantLights.push(diningRoomCupboardLight)
allLights.push(diningRoomCupboardLight)
// Esszimmer Regallicht
let diningRoomShelfLight = new UrlSwitchItem('Gnd', 'DiningRoom', 'ShelfLight', 'Regallicht Esszimmer', 'http://172.16.2.43/dv?dv=1023', 'http://172.16.2.43/dv?dv=0')
let diningRoomShelfLight = new UrlSwitchItem('Gnd', 'Esszimmer', 'ShelfLight', 'Regallicht', 'http://172.16.2.43/dv?dv=1023', 'http://172.16.2.43/dv?dv=0')
// diningRoomShelfLight.start()
// allLabeledItems.push(diningRoomShelfLight)
// allRelevantLights.push(diningRoomShelfLight)
let diningRoomNaehkaestchenLight = new HueColorBulbItem('Gnd', 'DiningRoom', 'NaehkaestchenLight', 'Lampe Naehkaestchen', 15)
let diningRoomNaehkaestchenLight = new HueColorBulbItem('Gnd', 'Esszimmer', 'NaehkaestchenLight', 'Nähkästchen', 15)
diningRoomNaehkaestchenLight.start()
allLabeledItems.push(diningRoomNaehkaestchenLight)
allRelevantLights.push(diningRoomNaehkaestchenLight)
allLights.push(diningRoomNaehkaestchenLight)
let windowContactDiningRoom1 = new MaxWindowContact('Gnd', 'DiningRoom', 'WindowContact1', 'Fenster Esszimmer Straße links', 26)
let windowContactDiningRoom1 = new MaxWindowContact('Gnd', 'Esszimmer', 'WindowContact1', 'Essz. links', 26)
windowContactDiningRoom1.start()
allLabeledItems.push(windowContactDiningRoom1)
allWindows.push(windowContactDiningRoom1)
let windowContactDiningRoom2 = new MaxWindowContact('Gnd', 'DiningRoom', 'WindowContact2', 'Fenster Esszimmer Straße rechts', 27)
let windowContactDiningRoom2 = new MaxWindowContact('Gnd', 'Esszimmer', 'WindowContact2', 'Essz. rechts', 27)
windowContactDiningRoom2.start()
allLabeledItems.push(windowContactDiningRoom2)
allWindows.push(windowContactDiningRoom2)
let thermostatDiningRoom = new MaxThermostat('Gnd', 'DiningRoom', 'Thermostat', 'Thermostat Esszimmer', 31, [windowContactDiningRoom1, windowContactDiningRoom2])
let thermostatDiningRoom = new MaxThermostat('Gnd', 'Esszimmer', 'Thermostat', 'Thermostat Esszimmer', 31, [windowContactDiningRoom1, windowContactDiningRoom2])
thermostatDiningRoom.start()
thermostatDiningRoom.setPresetTemperature(21.0)
allLabeledItems.push(thermostatDiningRoom)
@ -157,39 +165,43 @@ allThermostatItems.push(thermostatDiningRoom)
// Wohnzimmer -----------------------------------------------------------------------------------------------
// Wohnzimmer grosse Lampe 65557 24 1 65556 24 1
let livingRoomLargeLight = new M433SwitchItem('Gnd', 'LivingRoom', 'LargeLight', 'große Lampe Wohnzimmer', '65557 24 1', '65556 24 1')
let livingRoomLargeLight = new M433SwitchItem('Gnd', 'Wohnzimmer', 'LargeLight', 'große Lampe', '65557 24 1', '65556 24 1')
livingRoomLargeLight.start()
allLabeledItems.push(livingRoomLargeLight)
allRelevantLights.push(livingRoomLargeLight)
allLights.push(livingRoomLargeLight)
// Wohnzimmer kleine Lampe 87061 24 1 87060 24 1
let livingRoomSmallLight = new M433SwitchItem('Gnd', 'LivingRoom', 'SmallLight', 'kleine Lampe Wohnzimmer', '87061 24 1', '87060 24 1')
let livingRoomSmallLight = new M433SwitchItem('Gnd', 'Wohnzimmer', 'SmallLight', 'kleine Lampe', '87061 24 1', '87060 24 1')
livingRoomSmallLight.start()
allLabeledItems.push(livingRoomSmallLight)
allRelevantLights.push(livingRoomSmallLight)
allLights.push(livingRoomSmallLight)
// Wohnzimmer Sterne 69909 24 1 69908 24 1
let livingRoomStars = new M433SwitchItem('Gnd', 'LivingRoom', 'Stars', 'Sterne Wohnzimmer', '69909 24 1', '69908 24 1')
let livingRoomStars = new M433SwitchItem('Gnd', 'Wohnzimmer', 'Stars', 'Sterne', '69909 24 1', '69908 24 1')
livingRoomStars.start()
allLabeledItems.push(livingRoomStars)
allRelevantLights.push(livingRoomStars)
allLights.push(livingRoomStars)
// Wohnzimmer kleine Stehlampe 81941 24 1 81940 24 1
let livingRoomStandLight = new M433SwitchItem('Gnd', 'LivingRoom', 'StandLight', 'Stehlampe Wohnzimmer', '81941 24 1', '81940 24 1')
let livingRoomStandLight = new M433SwitchItem('Gnd', 'Wohnzimmer', 'StandLight', 'Stehlampe', '81941 24 1', '81940 24 1')
livingRoomStandLight.start()
allLabeledItems.push(livingRoomStandLight)
allRelevantLights.push(livingRoomStandLight)
allLights.push(livingRoomStandLight)
let windowContactLivingRoom1 = new MaxWindowContact('Gnd', 'LivingRoom', 'WindowContact1', 'Fenster Wohnzimmer Garten rechts', 28)
let windowContactLivingRoom1 = new MaxWindowContact('Gnd', 'Wohnzimmer', 'WindowContact1', 'Wohnz. rechts', 28)
windowContactLivingRoom1.start()
allLabeledItems.push(windowContactLivingRoom1)
allWindows.push(windowContactLivingRoom1)
let windowContactLivingRoom2 = new MaxWindowContact('Gnd', 'LivingRoom', 'WindowContact2', 'Fenster Wohnzimmer Garten links', 29)
let windowContactLivingRoom2 = new MaxWindowContact('Gnd', 'Wohnzimmer', 'WindowContact2', 'Wohnz. links', 29)
windowContactLivingRoom2.start()
allLabeledItems.push(windowContactLivingRoom2)
allWindows.push(windowContactLivingRoom2)
let thermostatLivingRoom = new MaxThermostat('Gnd', 'LivingRoom', 'Thermostat', 'Thermostat Wohnzimmer', 30, [windowContactLivingRoom1, windowContactLivingRoom2])
let thermostatLivingRoom = new MaxThermostat('Gnd', 'Wohnzimmer', 'Thermostat', 'Thermostat Wohnzimmer', 30, [windowContactLivingRoom1, windowContactLivingRoom2])
thermostatLivingRoom.start()
thermostatLivingRoom.setPresetTemperature(21.0)
allLabeledItems.push(thermostatLivingRoom)
@ -197,35 +209,38 @@ allThermostatItems.push(thermostatLivingRoom)
// Flur -----------------------------------------------------------------------------------------------------
// Flur Schreibtisch 83221 24 1 83220 24 1
let hallwayDeskLight = new M433SwitchItem('Gnd', 'Hallway', 'DeskLight', 'Schreibtischlampe Flur', '83221 24 1', '83220 24 1')
let hallwayDeskLight = new M433SwitchItem('Gnd', 'Flur', 'DeskLight', 'Schreibtischlampe', '83221 24 1', '83220 24 1')
hallwayDeskLight.start()
allLabeledItems.push(hallwayDeskLight)
allRelevantLights.push(hallwayDeskLight)
allLights.push(hallwayDeskLight)
// Flur Stehlampe 8704914 24 5 8793154 24 5
let hallwayStandLight = new M433SwitchItem('Gnd', 'Hallway', 'StandLight', 'Stehlampe Flur', '8704914 24 5', '8793154 24 5')
let hallwayStandLight = new M433SwitchItem('Gnd', 'Flur', 'StandLight', 'Stehlampe', '8704914 24 5', '8793154 24 5')
hallwayStandLight.start()
allLabeledItems.push(hallwayStandLight)
allRelevantLights.push(hallwayStandLight)
allLights.push(hallwayStandLight)
// Flur Schranklicht 66581 24 1 66580 24 1
let hallwayWardrobeLight = new M433SwitchItem('Gnd', 'Hallway', 'WardrobeLight', 'Schranklicht Flur', '66581 24 1', '66580 24 1')
let hallwayWardrobeLight = new M433SwitchItem('Gnd', 'Flur', 'WardrobeLight', 'Schranklicht', '66581 24 1', '66580 24 1')
hallwayWardrobeLight.start()
allLabeledItems.push(hallwayWardrobeLight)
allRelevantLights.push(hallwayWardrobeLight)
allLights.push(hallwayWardrobeLight)
let windowContactHallway = new MaxWindowContact('Gnd', 'Hallway', 'WindowContact', 'Fenster Flur', 25)
let windowContactHallway = new MaxWindowContact('Gnd', 'Flur', 'WindowContact', 'Flur', 25)
windowContactHallway.start()
allLabeledItems.push(windowContactHallway)
allWindows.push(windowContactHallway)
let thermostatHallway1 = new MaxThermostat('Gnd', 'Hallway', 'Thermostat1', 'Thermostat Flur vorne', 32, [])
let thermostatHallway1 = new MaxThermostat('Gnd', 'Flur', 'Thermostat1', 'Thermostat Flur vorne', 32, [])
thermostatHallway1.start()
thermostatHallway1.setPresetTemperature(19.0)
allLabeledItems.push(thermostatHallway1)
allThermostatItems.push(thermostatHallway1)
let thermostatHallway2 = new MaxThermostat('Gnd', 'Hallway', 'Thermostat2', 'Thermostat Flur hinten', 33, [])
let thermostatHallway2 = new MaxThermostat('Gnd', 'Flur', 'Thermostat2', 'Thermostat Flur hinten', 33, [])
thermostatHallway2.start()
thermostatHallway2.setPresetTemperature(5.0)
allLabeledItems.push(thermostatHallway2)
@ -233,31 +248,35 @@ allThermostatItems.push(thermostatHallway2)
// Küche ----------------------------------------------------------------------------------------------------
// Küche Fensterbank 66837 24 1 66836 24 1
let kitchenWindowLight = new M433SwitchItem('Gnd', 'Kitchen', 'WindowLight', 'Fensterbanklicht Küche', '66837 24 1', '66836 24 1')
let kitchenWindowLight = new M433SwitchItem('Gnd', 'Kueche', 'WindowLight', 'Fensterbanklicht', '66837 24 1', '66836 24 1')
kitchenWindowLight.start()
allLabeledItems.push(kitchenWindowLight)
allRelevantLights.push(kitchenWindowLight)
allLights.push(kitchenWindowLight)
// Küche Deckenlampe 82197 24 1 82196 24 1
let kitchenCeilingLight = new M433SwitchItem('Gnd', 'Kitchen', 'CeilingLight', 'Deckenlampe Küche', '82197 24 1', '82196 24 1')
let kitchenCeilingLight = new M433SwitchItem('Gnd', 'Kueche', 'CeilingLight', 'Deckenlampe', '82197 24 1', '82196 24 1')
kitchenCeilingLight.start()
allLabeledItems.push(kitchenCeilingLight)
allRelevantLights.push(kitchenCeilingLight)
allLights.push(kitchenCeilingLight)
// Schlafzimmer ---------------------------------------------------------------------------------------------
// Schlafzimmer Wolfgangs Seite 13976916 24 1 13976913 24 1
let bedRoomWolfgangsSide = new M433SwitchItem('1st', 'BedRoom', 'WolfgangsSide', 'Wolfgangs Seite Schlafzimmer', '13976916 24 1', '13976913 24 1')
let bedRoomWolfgangsSide = new M433SwitchItem('1st', 'Schlafzimmer', 'WolfgangsSide', 'Wolfgangs Seite', '13976916 24 1', '13976913 24 1')
bedRoomWolfgangsSide.start()
allLabeledItems.push(bedRoomWolfgangsSide)
allRelevantLights.push(bedRoomWolfgangsSide)
allLights.push(bedRoomWolfgangsSide)
let bedRoomWolfgangBedLight = new HueColorBulbItem('1st', 'BedRoom', 'WolfgangBedLight', 'Bettlicht', 16)
let bedRoomWolfgangBedLight = new HueColorBulbItem('1st', 'Schlafzimmer', 'WolfgangBedLight', 'Wolfgangs Bettlicht', 16)
bedRoomWolfgangBedLight.start()
allLabeledItems.push(bedRoomWolfgangBedLight)
allRelevantLights.push(bedRoomWolfgangBedLight)
allLights.push(bedRoomWolfgangBedLight)
let bedRoomWolfgangBedLightDimmerAdaptor = new DimmerAdaptor('1st', 'BedRoom', 'WolfgangBedLight')
let bedRoomWolfgangBedLightDimmerAdaptor = new DimmerAdaptor('1st', 'Schlafzimmer', 'WolfgangBedLight')
bedRoomWolfgangBedLightDimmerAdaptor.start()
let touchSwitchMultiButtonThing = new TouchSwitchMultiButtonThing('1st', 'Bedroom', 'Wolfgang',
@ -265,28 +284,30 @@ let touchSwitchMultiButtonThing = new TouchSwitchMultiButtonThing('1st', 'Bedroo
touchSwitchMultiButtonThing.start()
// Schlafzimmer Pattys Seite 13980756 24 1 13980753 24 1
let bedRoomPattysSide = new M433SwitchItem('1st', 'BedRoom', 'PattysSide', 'Pattys Seite Schlafzimmer', '13980756 24 1', '13980753 24 1')
let bedRoomPattysSide = new M433SwitchItem('1st', 'Schlafzimmer', 'PattysSide', 'Pattys Seite', '13980756 24 1', '13980753 24 1')
bedRoomPattysSide.start()
allLabeledItems.push(bedRoomPattysSide)
allRelevantLights.push(bedRoomPattysSide)
allLights.push(bedRoomPattysSide)
// Schlafzimmer Fensterbank 13979988 24 1 13979985 24 1
let bedRoomWindowLight = new M433SwitchItem('1st', 'BedRoom', 'WindowLight', 'Fensterbanklicht Schlafzimmer', '13979988 24 1', '13979985 24 1')
let bedRoomWindowLight = new M433SwitchItem('1st', 'Schlafzimmer', 'WindowLight', 'Fensterbanklicht', '13979988 24 1', '13979985 24 1')
bedRoomWindowLight.start()
allLabeledItems.push(bedRoomWindowLight)
allRelevantLights.push(bedRoomWindowLight)
allLights.push(bedRoomWindowLight)
let windowContactBedroomStreet1st = new MaxWindowContact('1st', 'Bedroom', 'WindowContactStreet', 'Fenster Schlafzimmer Strasse', 17)
let windowContactBedroomStreet1st = new MaxWindowContact('1st', 'Bedroom', 'WindowContactStreet', 'Schlafz. Strasse', 17)
windowContactBedroomStreet1st.start()
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', 'Schlafz. Garten 1', 18)
windowContact1BedroomGarden1st.start()
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', 'Schlafz. Garten 2', 22)
windowContact2BedroomGarden1st.start()
allLabeledItems.push(windowContact2BedroomGarden1st)
allWindows.push(windowContact2BedroomGarden1st)
@ -308,7 +329,7 @@ let thermostatBedroom1stCron = new Cron('thermostatBedroom1stCron', thermostatBe
thermostatBedroom1stCron.start()
// ---------------------------------------------------------------------------------------------------------
let dayLightScene = new LightScene('Gnd', 'Hallway', 'DayLight', 'DayLight',
let dayLightScene = new LightScene('Gnd', 'Szenen', 'DayLight', 'DayLight',
[
kitchenWindowLight, kitchenCeilingLight, hallwayDeskLight, hallwayStandLight, hallwayWardrobeLight,
diningRoomSmallLight, diningRoomStandLight, diningRoomCupboardLight, diningRoomShelfLight,
@ -318,8 +339,9 @@ let dayLightScene = new LightScene('Gnd', 'Hallway', 'DayLight', 'DayLight',
)
dayLightScene.start()
allLabeledItems.push(dayLightScene)
allLightScenes.push(dayLightScene)
let ecoLightScene = new LightScene('Gnd', 'Hallway', 'EcoLight', 'EcoLight',
let ecoLightScene = new LightScene('Gnd', 'Szenen', 'EcoLight', 'EcoLight',
[
kitchenWindowLight, hallwayDeskLight, hallwayWardrobeLight,
diningRoomSmallLight, diningRoomStandLight, diningRoomCupboardLight, diningRoomShelfLight,
@ -332,11 +354,12 @@ let ecoLightScene = new LightScene('Gnd', 'Hallway', 'EcoLight', 'EcoLight',
)
ecoLightScene.start()
allLabeledItems.push(ecoLightScene)
allLightScenes.push(ecoLightScene)
let ecoSwitch = new MaxEcoSwitch('Gnd', 'Hallway', 'EcoSwitch', 'EcoSwitch', 6, dayLightScene, ecoLightScene)
let ecoSwitch = new MaxEcoSwitch('Gnd', 'Szenen', 'EcoSwitch', 'EcoSwitch', 6, dayLightScene, ecoLightScene)
ecoSwitch.start()
let morningLightScene = new LightScene('Gnd', 'Hallway', 'MorningLight', 'MorningLight',
let morningLightScene = new LightScene('Gnd', 'Szenen', 'MorningLight', 'MorningLight',
[
kitchenWindowLight, kitchenCeilingLight, hallwayDeskLight, hallwayWardrobeLight,
hallwayStandLight
@ -348,10 +371,14 @@ let morningLightScene = new LightScene('Gnd', 'Hallway', 'MorningLight', 'Mornin
)
morningLightScene.start()
allLabeledItems.push(morningLightScene)
allLightScenes.push(morningLightScene)
let sceneOfAllLights = new LightScene('Gnd', 'Szenen', 'AllLights', 'Alle Lampen', allLights, [])
sceneOfAllLights.start()
allLightScenes.push(sceneOfAllLights)
// ----------------------------------------------------------------------------------------------------------
let windowContactBathroomGnd = new MaxWindowContact('Gnd', 'Bathroom', 'WindowContact', 'Fenster Bad unten', 7)
let windowContactBathroomGnd = new MaxWindowContact('Gnd', 'Bathroom', 'WindowContact', 'Bad unten', 7)
windowContactBathroomGnd.start()
allLabeledItems.push(windowContactBathroomGnd)
allWindows.push(windowContactBathroomGnd)
@ -372,7 +399,7 @@ let thermostatBathroomGndCron = new Cron('thermostatBathroomGndCron', thermostat
thermostatBathroomGndCron.start()
let windowContactBathroom1st = new MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Fenster Bad oben', 2)
let windowContactBathroom1st = new MaxWindowContact('1st', 'Bathroom', 'WindowContact', 'Bad oben', 2)
windowContactBathroom1st.start()
allLabeledItems.push(windowContactBathroom1st)
allWindows.push(windowContactBathroom1st)
@ -394,24 +421,24 @@ thermostatBathroom1stCron.start()
let windowContactKitchen1 = new MaxWindowContact('Gnd', 'Kitchen', 'WindowContact1', 'Fenster Küche Garten', 11)
let windowContactKitchen1 = new MaxWindowContact('Gnd', 'Kueche', 'WindowContact1', 'Küche Garten', 11)
windowContactKitchen1.start()
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', 'Kueche', 'WindowContact2', 'Küche Terassentür', 10)
windowContactKitchen2.start()
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', 'Kueche', 'WindowContact3', 'Küche Straße 1', 12)
windowContactKitchen3.start()
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', 'Kueche', 'WindowContact4', 'Küche Straße 2', 13)
windowContactKitchen4.start()
allLabeledItems.push(windowContactKitchen4)
allWindows.push(windowContactKitchen4)
let thermostatKitchen = new MaxThermostat('Gnd', 'Kitchen', 'Thermostat', 'Thermostat Küche', 14, [
let thermostatKitchen = new MaxThermostat('Gnd', 'Kueche', 'Thermostat', 'Thermostat Küche', 14, [
windowContactKitchen1, windowContactKitchen2, windowContactKitchen3, windowContactKitchen4])
thermostatKitchen.start()
thermostatKitchen.setPresetTemperature(20.0)
@ -428,7 +455,7 @@ let thermostatKitchenCron = new Cron('thermostatKitchenCron', thermostatKitchen,
thermostatKitchenCron.start()
// ----------------------------------------------------------------------------------------------------------
let windowContactFrontdoor = new MaxWindowContact('Gnd', 'Hallway', 'FrontdoorContact', 'Haustür', 23)
let windowContactFrontdoor = new MaxWindowContact('Gnd', 'Flur', 'FrontdoorContact', 'Haustür', 23)
windowContactFrontdoor.start()
allLabeledItems.push(windowContactFrontdoor)
@ -450,15 +477,17 @@ heatingSceneAll.start()
// ----------------------------------------------------------------------------------------------------------
// Basement
let workshopLight = new HomematicSwitchItem('Base', 'Workshop', 'Light', 'Licht Werkstatt', 5)
let workshopLight = new HomematicSwitchItem('Base', 'Keller', 'Light', 'Werkstatt', 5)
workshopLight.start()
allLabeledItems.push(workshopLight)
allRelevantLights.push(workshopLight)
allLights.push(workshopLight)
let basementSmallLight = new HomematicSwitchItem('Base', 'Hallway', 'SmallLight', 'Licht Keller einfach', 35, 1)
let basementSmallLight = new HomematicSwitchItem('Base', 'Keller', 'SmallLight', 'Licht einfach', 35, 1)
basementSmallLight.start()
allLabeledItems.push(basementSmallLight)
allRelevantLights.push(basementSmallLight)
allLights.push(basementSmallLight)
basementSmallLight.on('somethingChanged', () => {
if (basementSmallLight.getState() == 'ON') {
setTimeout(() => {
@ -472,10 +501,11 @@ basementSmallLight.on('somethingChanged', () => {
}
})
let basementLargeLight = new HomematicSwitchItem('Base', 'Hallway', 'LargeLight', 'Licht Keller hell', 35, 2)
let basementLargeLight = new HomematicSwitchItem('Base', 'Keller', 'LargeLight', 'Licht hell', 35, 2)
basementLargeLight.start()
allLabeledItems.push(basementLargeLight)
allRelevantLights.push(basementLargeLight)
allLights.push(basementLargeLight)
basementLargeLight.on('somethingChanged', () => {
if (basementLargeLight.getState() == 'ON') {
mqttHandler.send(basementSmallLight.getStateTopic(), 'ON')
@ -497,13 +527,13 @@ let basementForwarderSwitchOffAdaptor = new SwitchOffAdaptor('Base', 'All', 'For
basementForwarderSwitchOffAdaptor.start()
// ----------------------------------------------------------------------------------------------------------
let twoLedSignal1 = new TwoLedSignal('Gnd', 'Hallway', 'TwoLedSignal1', 'Licht- und Fenster-Anzeiger',
let twoLedSignal1 = new TwoLedSignal('Gnd', 'Flur', 'TwoLedSignal1', 'Licht- und Fenster-Anzeiger',
allRelevantLights, "OFF", "ON",
allWindows, "CLOSED", "OPEN")
twoLedSignal1.start()
// MySwitchTHing
let mySwitchThingWolfgang = new MySwitchThing('1st', 'BedRoom', 'WolfgangsSwitch', [
let mySwitchThingWolfgang = new MySwitchThing('1st', 'Schlafzimmer', 'WolfgangsSwitch', [
new MySwitchSingleItem(bedRoomWolfgangBedLightDimmerAdaptor.getInTopic()),
new MySwitchSingleItem(basementForwarderSwitchOffAdaptor.getInTopic()),
new MySwitchSingleItem('IoT/InsLeere/2'),
@ -512,32 +542,32 @@ mySwitchThingWolfgang.start()
// ----------------------------------------------------------------------------------------------------------
let testFourButton = new HomematicFourButtonThing('Gnd', 'Hallway', 'TestButton', 9, [
new HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/Testlight/dimmerIn'),
new HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Hallway/DeskLight/timerIn'),
let testFourButton = new HomematicFourButtonThing('Gnd', 'Flur', 'TestButton', 9, [
new HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Flur/Testlight/dimmerIn'),
new HomematicFourButtonSingleItem('dispatcher_ng/items/Gnd/Flur/DeskLight/timerIn'),
new HomematicFourButtonSingleItem('test/button/3'),
new HomematicFourButtonSingleItem('test/button/4')
])
testFourButton.start()
let testDimmerAdaptor = new DimmerAdaptor('Gnd', 'Hallway', 'Testlight')
let testDimmerAdaptor = new DimmerAdaptor('Gnd', 'Flur', 'Testlight')
testDimmerAdaptor.start()
let testTimerAdaptor = new TimerAdaptor('Gnd', 'Hallway', 'DeskLight', 10)
let testTimerAdaptor = new TimerAdaptor('Gnd', 'Flur', 'DeskLight', 10)
testTimerAdaptor.start()
let testLight = new HomematicDimmerItem('Gnd', 'Hallway', 'Testlight', 'Testlampe mit Dimmer', 8)
let testLight = new HomematicDimmerItem('Gnd', 'Flur', 'Testlight', 'Testlampe mit Dimmer', 8)
testLight.start()
let testForwarder = new Forwarder('Gnd', 'Hallway', 'TestForwarder', 'state', 'TestForwarder', [
'dispatcher_ng/items/Gnd/Hallway/Testlight2/state',
'dispatcher_ng/items/Gnd/Hallway/DeskLight/state'
let testForwarder = new Forwarder('Gnd', 'Flur', 'TestForwarder', 'state', 'TestForwarder', [
'dispatcher_ng/items/Gnd/Flur/Testlight2/state',
'dispatcher_ng/items/Gnd/Flur/DeskLight/state'
])
testForwarder.start()
let testScene = new LightScene('Gnd', 'Hallway', 'TestScene', 'TestScene',
let testScene = new LightScene('Gnd', 'Flur', 'TestScene', 'TestScene',
[aquariumLight, annaBedLight],
[matthiasStandLights, matthiasBedLight]
)
@ -599,7 +629,38 @@ if (heatingMainSwitchExport != null) {
fs.writeFileSync(config.dict.homekitFile, JSON.stringify(homekitObject, null, 4))
fs.writeFileSync(config.dict.openhabItemFile, openhabList.join('\n'))
let roomSwitches: any = {}
allLights.forEach((item: HasStateAndFeedbackTopicAndLabelAndRoom) => {
let switchItem = {'label': item.getLabel(), 'actionTopic': item.getStateTopic(), 'feedbackTopic': item.getStateFeedbackTopic()}
if (item.getRoom() in roomSwitches) {
roomSwitches[item.getRoom()].push(switchItem)
} else {
roomSwitches[item.getRoom()] = [ switchItem ]
}
})
let smartClientConfiguration : any = {}
smartClientConfiguration['switches'] = []
for (let key in roomSwitches) {
let item : any = { 'room': key, 'switches': roomSwitches[key]}
smartClientConfiguration['switches'].push(item)
}
smartClientConfiguration['scenes'] = []
allLightScenes.forEach((scene : HasStateAndFeedbackTopicAndLabelAndRoom) => {
let item : any = { 'label': scene.getLabel(), 'actionTopic': scene.getStateTopic() }
smartClientConfiguration['scenes'].push(item)
})
smartClientConfiguration['windows'] = []
allWindows.forEach((window : HasStateAndFeedbackTopicAndLabel) => {
let item : any = { 'label': window.getLabel(), 'topic': window.getStateFeedbackTopic() }
smartClientConfiguration['windows'].push(item)
})
fs.writeFileSync('smartclient.json', JSON.stringify(smartClientConfiguration, null, 4))
// ----------------------------------------------------------------------------------------------------------
mqttHandler.exec()
logger.info("Dispatcher running")
mqttHandler.send('smartclient/configuration', JSON.stringify(smartClientConfiguration, null, 4))