This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
generated from homebridge/homebridge-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 17
/
getCharacteristicsForModel.ts
167 lines (164 loc) · 6.6 KB
/
getCharacteristicsForModel.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import type { Logger, Service } from 'homebridge'
import type { HomebridgeLgThinqPlatform } from './platform'
import ActiveCharacteristic from './characteristic/activeCharacteristic'
import AbstractCharacteristic from './characteristic/abstractCharacteristic'
import SwingModeCharacteristic from './characteristic/swingModeCharacteristic'
import RotationSpeedCharacteristic from './characteristic/rotationSpeedCharacteristic'
import CoolingThresholdTemperatureCharacteristic from './characteristic/coolingThresholdTemperatureCharacteristic'
import HeatingThresholdTemperatureCharacteristic from './characteristic/heatingThresholdTemperatureCharacteristic'
import TargetHeaterCoolerStateCharacteristic from './characteristic/targetHeaterCoolerStateCharacteristic'
import CurrentHeaterCoolerStateCharacteristic from './characteristic/currentHeaterCoolerStateCharacteristic'
import CurrentTemperatureCharacteristic from './characteristic/currentTemperatureCharacteristic'
import FilterChangeCharacteristic from './characteristic/filterChangeCharacteristic'
import FilterLifeCharacteristic from './characteristic/filterLifeCharacteristic'
export default function getCharacteristicsForModel(
model: string,
platform: HomebridgeLgThinqPlatform,
service: Service,
deviceId: string,
log: Logger,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): Array<AbstractCharacteristic<any, any, any>> {
switch (model) {
case 'RAC_056905_WW':
case 'CVT_493401_WW':
return [
new ActiveCharacteristic(platform, service, deviceId),
// TODO: These units (or at least RAC_056905_WW does) support variable-position, not just "all or nothing"
new SwingModeCharacteristic(platform, service, deviceId),
new RotationSpeedCharacteristic(platform, service, deviceId, 4),
new CoolingThresholdTemperatureCharacteristic(
platform,
service,
deviceId,
),
new HeatingThresholdTemperatureCharacteristic(
platform,
service,
deviceId,
),
new TargetHeaterCoolerStateCharacteristic(
platform,
service,
deviceId,
true,
),
new CurrentHeaterCoolerStateCharacteristic(
platform,
service,
deviceId,
true,
),
new CurrentTemperatureCharacteristic(platform, service, deviceId),
new FilterChangeCharacteristic(platform, service, deviceId),
new FilterLifeCharacteristic(platform, service, deviceId),
]
// LW8017ERSM -- 3 fan modes
// LW1517IVSM -- 4 fan modes
case 'WIN_056905_WW':
return [
new ActiveCharacteristic(platform, service, deviceId),
new RotationSpeedCharacteristic(platform, service, deviceId),
new CoolingThresholdTemperatureCharacteristic(
platform,
service,
deviceId,
),
new HeatingThresholdTemperatureCharacteristic(
platform,
service,
deviceId,
),
new TargetHeaterCoolerStateCharacteristic(platform, service, deviceId),
new CurrentHeaterCoolerStateCharacteristic(platform, service, deviceId),
new CurrentTemperatureCharacteristic(platform, service, deviceId),
new FilterChangeCharacteristic(platform, service, deviceId),
new FilterLifeCharacteristic(platform, service, deviceId),
]
// FQ17SADWEN
case 'PAC_910604_WW':
return [
new ActiveCharacteristic(platform, service, deviceId),
// TODO: This model uses upDown/left/leftRight values which aren't supported yet
// new SwingModeCharacteristic(platform, service, deviceId),
// TODO: This model has rotation speeds in a range not supported yet, such as `2056`
// new RotationSpeedCharacteristic(platform, service, deviceId),
new CoolingThresholdTemperatureCharacteristic(
platform,
service,
deviceId,
),
new HeatingThresholdTemperatureCharacteristic(
platform,
service,
deviceId,
),
new TargetHeaterCoolerStateCharacteristic(platform, service, deviceId),
new CurrentHeaterCoolerStateCharacteristic(platform, service, deviceId),
new CurrentTemperatureCharacteristic(platform, service, deviceId),
new FilterChangeCharacteristic(platform, service, deviceId),
new FilterLifeCharacteristic(platform, service, deviceId),
]
// UM30R.N10 with PWFMDD200 wifi module
case 'DUCT_626301_WW':
return [
new ActiveCharacteristic(platform, service, deviceId),
new SwingModeCharacteristic(platform, service, deviceId),
new RotationSpeedCharacteristic(platform, service, deviceId),
new CoolingThresholdTemperatureCharacteristic(
platform,
service,
deviceId,
),
new HeatingThresholdTemperatureCharacteristic(
platform,
service,
deviceId,
),
new TargetHeaterCoolerStateCharacteristic(
platform,
service,
deviceId,
true,
),
new CurrentHeaterCoolerStateCharacteristic(
platform,
service,
deviceId,
true,
),
new CurrentTemperatureCharacteristic(platform, service, deviceId),
new FilterChangeCharacteristic(platform, service, deviceId),
new FilterLifeCharacteristic(platform, service, deviceId),
]
// LP1419IVSM
case 'POT_056905_WW':
default:
if (model !== 'POT_056905_WW') {
log.error(
`Unsupported model: ${model}. Please open a GitHub issue at https://github.com/sman591/homebridge-lg-thinq-ac/issues to ` +
'request support for your model. Falling back to default "POT_056905_WW" model instead.',
)
}
return [
new ActiveCharacteristic(platform, service, deviceId),
new SwingModeCharacteristic(platform, service, deviceId),
new RotationSpeedCharacteristic(platform, service, deviceId),
new CoolingThresholdTemperatureCharacteristic(
platform,
service,
deviceId,
),
new HeatingThresholdTemperatureCharacteristic(
platform,
service,
deviceId,
),
new TargetHeaterCoolerStateCharacteristic(platform, service, deviceId),
new CurrentHeaterCoolerStateCharacteristic(platform, service, deviceId),
new CurrentTemperatureCharacteristic(platform, service, deviceId),
new FilterChangeCharacteristic(platform, service, deviceId),
new FilterLifeCharacteristic(platform, service, deviceId),
]
}
}