generated from homebridge/homebridge-plugin-template
/
commonTypes.ts
72 lines (65 loc) · 1.8 KB
/
commonTypes.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Various Type Definitions for the dingz Accessory
// Based on the API definition
import { DingzAccessory } from '../dingzAccessory';
import { MyStromSwitchAccessory } from '../myStromSwitchAccessory';
import { MyStromLightbulbAccessory } from '../myStromLightbulbAccessory';
import { MyStromButtonAccessory } from '../myStromButtonAccessory';
import { MyStromPIRAccessory } from '../myStromPIRAccessory';
// Types
import {
DingzDeviceInfo,
DingzInputInfoItem,
DingzDeviceSystemConfig,
DingzDeviceDimmerConfig,
DingzWindowCoveringConfigItem,
} from './dingzTypes';
import { MyStromDeviceInfo } from './myStromTypes';
export enum DeviceTypes {
MYSTROM_SWITCH_CHV1 = 101,
MYSTROM_BULB = 102,
MYSTROM_BUTTON_PLUS = 103,
MYSTROM_BUTTON = 104,
MYSTROM_LEDSTRIP = 105,
MYSTROM_SWITCH_CHV2 = 106,
MYSTROM_SWITCH_EU = 107,
DINGZ = 108,
MYSTROM_PIR = 110,
}
export enum ButtonAction {
SINGLE_PRESS = '1',
DOUBLE_PRESS = '2',
LONG_PRESS = '3',
PIR_MOTION_START = '8',
PIR_MOTION_STOP = '9',
}
export interface DeviceInfo {
name: string;
address: string;
mac: string;
model?: string;
token?: string;
hwInfo?: DingzDeviceInfo | MyStromDeviceInfo;
systemConfig?: DingzDeviceSystemConfig;
dimmerConfig?: DingzDeviceDimmerConfig;
windowCoveringConfig?: DingzWindowCoveringConfigItem[];
dingzInputInfo?: DingzInputInfoItem[];
lastUpdate?: Date;
accessoryClass?:
| 'DingzDaAccessory'
| 'MyStromSwitchAccessory'
| 'MyStromLightbulbAccessory'
| 'MyStromButtonAccessory'
| 'MyStromPIRAccessory';
}
export type AccessoryType =
| DingzAccessory
| MyStromSwitchAccessory
| MyStromLightbulbAccessory
| MyStromButtonAccessory
| MyStromPIRAccessory;
export interface AccessoryTypes {
[key: string]: AccessoryType;
}
export interface AccessoryActionUrl {
url: string;
}