Skip to content

Commit

Permalink
Merge pull request #117 from Palmke/familynames
Browse files Browse the repository at this point in the history
Forward Alarm Arm Delay Event
  • Loading branch information
bropat authored Jul 30, 2022
2 parents f3fb0b9 + 9ac12eb commit 5bc60d2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/lib/forward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,6 @@ export class EventForwarder {
case CommandType.CMD_INDOOR_ROTATE:
command = DeviceCommand.panAndTilt;
break;
case CommandType.CMD_INDOOR_PAN_CALIBRATION:
command = DeviceCommand.calibrate;
break;
case CommandType.CMD_SET_DEVS_TONE_FILE:
command = DeviceCommand.triggerAlarm;
break;
Expand Down Expand Up @@ -529,11 +526,19 @@ export class EventForwarder {
station.on("alarm armed event", (station: Station) => {
this.forwardEvent({
source: "station",
event: StationEvent.alarmDelayEvent,
event: StationEvent.alarmArmedEvent,
serialNumber: station.getSerial()
}, 11);
});

station.on("alarm arm delay event", (station: Station, armDelay: number) => {
this.forwardEvent({
source: "station",
event: StationEvent.alarmArmDelayEvent,
serialNumber: station.getSerial(),
armDelay: armDelay
}, 11);
});
}

private setupDevice(device: Device): void {
Expand Down
11 changes: 10 additions & 1 deletion src/lib/station/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export enum StationEvent {
alarmEvent = "alarm event",
alarmDelayEvent = "alarm delay event",
alarmArmedEvent = "alarm armed event",
alarmArmDelayEvent = "alarm arm delay event",
}

export interface OutgoingEventStationBase extends OutgoingBaseEvent {
Expand Down Expand Up @@ -99,6 +100,13 @@ export interface OutgoingEventStationAlarmArmedEvent extends OutgoingEventStatio
serialNumber: string;
}

export interface OutgoingEventStationAlarmArmDelayEvent extends OutgoingEventStationBase {
source: "station";
event: StationEvent.alarmArmDelayEvent;
serialNumber: string;
armDelay: number;
}

export type OutgoingEventStation =
| OutgoingEventStationAdded
| OutgoingEventStationRemoved
Expand All @@ -110,4 +118,5 @@ export type OutgoingEventStation =
| OutgoingEventStationPropertyChanged
| OutgoingEventStationAlarmEvent
| OutgoingEventStationAlarmDelayEvent
| OutgoingEventStationAlarmArmedEvent;
| OutgoingEventStationAlarmArmedEvent
| OutgoingEventStationAlarmArmDelayEvent;

0 comments on commit 5bc60d2

Please sign in to comment.