-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
76 lines (62 loc) · 1.34 KB
/
types.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
73
74
75
76
export const NUMBER_1 = 1
export enum Mode {
cft = 0,
eco = 1,
fro = 2,
stop = 3,
cft1 = 4,
cft2 = 5,
}
export enum DerogMode {
off = 0,
vacation = 1,
boost = 2,
}
export enum Switch {
off = 0,
on = 1,
}
export type Data = Record<string, never>
export interface ErrorData {
readonly detail_message: string | null
readonly error_message: string | null
}
export interface LoginCredentials {
readonly password: string
readonly username: string
}
export interface LoginPostData {
readonly password: string
readonly username: string
}
export interface LoginData {
readonly expire_at: number
readonly token: string
}
export interface Bindings {
readonly devices: readonly {
readonly dev_alias: string
readonly did: string
readonly product_key: string
readonly product_name: string
}[]
}
export interface FirstGenDevicePostData {
readonly raw: [typeof NUMBER_1, typeof NUMBER_1, Mode]
}
export interface BaseAttrs {
cft_tempH?: number
cft_tempL?: number
derog_mode?: DerogMode
derog_time?: number
lock_switch?: Switch
mode?: Mode
timer_switch?: Switch
}
export interface DevicePostData {
readonly attrs: BaseAttrs
}
export type DevicePostDataAny = DevicePostData | FirstGenDevicePostData
export interface DeviceData {
readonly attr: Exclude<BaseAttrs, 'mode'> & { readonly mode: string }
}