@homelib/xiaomi 0.0.0-wip.01265bf1cc90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/README.md +26 -0
- package/bld/library/backend/client.d.ts +73 -0
- package/bld/library/backend/client.js +490 -0
- package/bld/library/backend/client.js.map +1 -0
- package/bld/library/backend/constants.d.ts +7 -0
- package/bld/library/backend/constants.js +11 -0
- package/bld/library/backend/constants.js.map +1 -0
- package/bld/library/backend/index.d.ts +3 -0
- package/bld/library/backend/index.js +4 -0
- package/bld/library/backend/index.js.map +1 -0
- package/bld/library/backend/oauth.d.ts +24 -0
- package/bld/library/backend/oauth.js +121 -0
- package/bld/library/backend/oauth.js.map +1 -0
- package/bld/library/binding.d.ts +44 -0
- package/bld/library/binding.js +212 -0
- package/bld/library/binding.js.map +1 -0
- package/bld/library/cloud/client.d.ts +27 -0
- package/bld/library/cloud/client.js +109 -0
- package/bld/library/cloud/client.js.map +1 -0
- package/bld/library/cloud/constants.d.ts +9 -0
- package/bld/library/cloud/constants.js +11 -0
- package/bld/library/cloud/constants.js.map +1 -0
- package/bld/library/cloud/device.d.ts +84 -0
- package/bld/library/cloud/device.js +686 -0
- package/bld/library/cloud/device.js.map +1 -0
- package/bld/library/cloud/index.d.ts +5 -0
- package/bld/library/cloud/index.js +6 -0
- package/bld/library/cloud/index.js.map +1 -0
- package/bld/library/cloud/mqtt.d.ts +69 -0
- package/bld/library/cloud/mqtt.js +517 -0
- package/bld/library/cloud/mqtt.js.map +1 -0
- package/bld/library/cloud/transport.d.ts +8 -0
- package/bld/library/cloud/transport.js +34 -0
- package/bld/library/cloud/transport.js.map +1 -0
- package/bld/library/command.d.ts +6 -0
- package/bld/library/command.js +6 -0
- package/bld/library/command.js.map +1 -0
- package/bld/library/configuration.d.ts +62 -0
- package/bld/library/configuration.js +303 -0
- package/bld/library/configuration.js.map +1 -0
- package/bld/library/device.d.ts +69 -0
- package/bld/library/device.js +266 -0
- package/bld/library/device.js.map +1 -0
- package/bld/library/devices/air-conditioner.d.ts +48 -0
- package/bld/library/devices/air-conditioner.js +155 -0
- package/bld/library/devices/air-conditioner.js.map +1 -0
- package/bld/library/devices/command-effect.d.ts +35 -0
- package/bld/library/devices/command-effect.js +269 -0
- package/bld/library/devices/command-effect.js.map +1 -0
- package/bld/library/devices/dehumidifier.d.ts +41 -0
- package/bld/library/devices/dehumidifier.js +124 -0
- package/bld/library/devices/dehumidifier.js.map +1 -0
- package/bld/library/devices/fan.d.ts +37 -0
- package/bld/library/devices/fan.js +135 -0
- package/bld/library/devices/fan.js.map +1 -0
- package/bld/library/devices/index.d.ts +9 -0
- package/bld/library/devices/index.js +10 -0
- package/bld/library/devices/index.js.map +1 -0
- package/bld/library/devices/light.d.ts +22 -0
- package/bld/library/devices/light.js +112 -0
- package/bld/library/devices/light.js.map +1 -0
- package/bld/library/devices/pet-feeder.d.ts +36 -0
- package/bld/library/devices/pet-feeder.js +116 -0
- package/bld/library/devices/pet-feeder.js.map +1 -0
- package/bld/library/devices/placeholder.d.ts +3 -0
- package/bld/library/devices/placeholder.js +4 -0
- package/bld/library/devices/placeholder.js.map +1 -0
- package/bld/library/devices/temperature-humidity-sensor.d.ts +14 -0
- package/bld/library/devices/temperature-humidity-sensor.js +56 -0
- package/bld/library/devices/temperature-humidity-sensor.js.map +1 -0
- package/bld/library/devices/value-range.d.ts +2 -0
- package/bld/library/devices/value-range.js +6 -0
- package/bld/library/devices/value-range.js.map +1 -0
- package/bld/library/endpoint-connection.d.ts +168 -0
- package/bld/library/endpoint-connection.js +510 -0
- package/bld/library/endpoint-connection.js.map +1 -0
- package/bld/library/index.d.ts +26 -0
- package/bld/library/index.js +33 -0
- package/bld/library/index.js.map +1 -0
- package/bld/library/local/certificate.d.ts +31 -0
- package/bld/library/local/certificate.js +298 -0
- package/bld/library/local/certificate.js.map +1 -0
- package/bld/library/local/controller.d.ts +70 -0
- package/bld/library/local/controller.js +498 -0
- package/bld/library/local/controller.js.map +1 -0
- package/bld/library/local/discovery.d.ts +29 -0
- package/bld/library/local/discovery.js +321 -0
- package/bld/library/local/discovery.js.map +1 -0
- package/bld/library/local/index.d.ts +6 -0
- package/bld/library/local/index.js +7 -0
- package/bld/library/local/index.js.map +1 -0
- package/bld/library/local/message.d.ts +11 -0
- package/bld/library/local/message.js +128 -0
- package/bld/library/local/message.js.map +1 -0
- package/bld/library/local/mqtt.d.ts +113 -0
- package/bld/library/local/mqtt.js +1074 -0
- package/bld/library/local/mqtt.js.map +1 -0
- package/bld/library/local/routed-message-client.d.ts +49 -0
- package/bld/library/local/routed-message-client.js +326 -0
- package/bld/library/local/routed-message-client.js.map +1 -0
- package/bld/library/miot/index.d.ts +4 -0
- package/bld/library/miot/index.js +5 -0
- package/bld/library/miot/index.js.map +1 -0
- package/bld/library/miot/matcher.d.ts +84 -0
- package/bld/library/miot/matcher.js +326 -0
- package/bld/library/miot/matcher.js.map +1 -0
- package/bld/library/miot/request.d.ts +33 -0
- package/bld/library/miot/request.js +57 -0
- package/bld/library/miot/request.js.map +1 -0
- package/bld/library/miot/result.d.ts +8 -0
- package/bld/library/miot/result.js +5 -0
- package/bld/library/miot/result.js.map +1 -0
- package/bld/library/miot/spec.d.ts +96 -0
- package/bld/library/miot/spec.js +86 -0
- package/bld/library/miot/spec.js.map +1 -0
- package/bld/library/provider.d.ts +78 -0
- package/bld/library/provider.js +600 -0
- package/bld/library/provider.js.map +1 -0
- package/bld/library/session-manager.d.ts +34 -0
- package/bld/library/session-manager.js +177 -0
- package/bld/library/session-manager.js.map +1 -0
- package/bld/library/session.d.ts +36 -0
- package/bld/library/session.js +370 -0
- package/bld/library/session.js.map +1 -0
- package/bld/library/storage.d.ts +2 -0
- package/bld/library/storage.js +66 -0
- package/bld/library/storage.js.map +1 -0
- package/bld/library/terminal/bindings.d.ts +3 -0
- package/bld/library/terminal/bindings.js +306 -0
- package/bld/library/terminal/bindings.js.map +1 -0
- package/bld/library/terminal/index.d.ts +2 -0
- package/bld/library/terminal/index.js +3 -0
- package/bld/library/terminal/index.js.map +1 -0
- package/bld/library/terminal/provider-details.d.ts +3 -0
- package/bld/library/terminal/provider-details.js +477 -0
- package/bld/library/terminal/provider-details.js.map +1 -0
- package/package.json +29 -0
- package/src/library/backend/client.ts +737 -0
- package/src/library/backend/constants.ts +17 -0
- package/src/library/backend/index.ts +3 -0
- package/src/library/backend/oauth.ts +170 -0
- package/src/library/binding.ts +387 -0
- package/src/library/cloud/client.ts +155 -0
- package/src/library/cloud/constants.ts +19 -0
- package/src/library/cloud/device.ts +938 -0
- package/src/library/cloud/index.ts +5 -0
- package/src/library/cloud/mqtt.ts +671 -0
- package/src/library/cloud/transport.ts +46 -0
- package/src/library/command.ts +7 -0
- package/src/library/configuration.ts +480 -0
- package/src/library/device.ts +601 -0
- package/src/library/devices/air-conditioner.ts +171 -0
- package/src/library/devices/command-effect.ts +425 -0
- package/src/library/devices/dehumidifier.ts +131 -0
- package/src/library/devices/fan.ts +140 -0
- package/src/library/devices/index.ts +9 -0
- package/src/library/devices/light.ts +119 -0
- package/src/library/devices/pet-feeder.ts +129 -0
- package/src/library/devices/placeholder.ts +3 -0
- package/src/library/devices/temperature-humidity-sensor.ts +49 -0
- package/src/library/devices/value-range.ts +14 -0
- package/src/library/endpoint-connection.ts +841 -0
- package/src/library/index.ts +71 -0
- package/src/library/local/certificate.ts +401 -0
- package/src/library/local/controller.ts +693 -0
- package/src/library/local/discovery.ts +485 -0
- package/src/library/local/index.ts +6 -0
- package/src/library/local/message.ts +174 -0
- package/src/library/local/mqtt.ts +1555 -0
- package/src/library/local/routed-message-client.ts +377 -0
- package/src/library/miot/index.ts +4 -0
- package/src/library/miot/matcher.ts +683 -0
- package/src/library/miot/request.ts +70 -0
- package/src/library/miot/result.ts +14 -0
- package/src/library/miot/spec.ts +114 -0
- package/src/library/provider.ts +745 -0
- package/src/library/session-manager.ts +224 -0
- package/src/library/session.ts +528 -0
- package/src/library/storage.ts +83 -0
- package/src/library/terminal/bindings.tsx +692 -0
- package/src/library/terminal/index.ts +2 -0
- package/src/library/terminal/provider-details.tsx +871 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { CommandError, Temperature, } from '@homelib/core';
|
|
2
|
+
import { getMiotEndpointConnectionProperty, } from '../endpoint-connection.js';
|
|
3
|
+
import { MiotSetPropertyRequest, isValidMiotSpecValueList, isValidMiotSpecValueRange, matchesMiotUrnPattern, } from '../miot/index.js';
|
|
4
|
+
import { clampAndQuantizeValue } from './value-range.js';
|
|
5
|
+
const MIOT_BRIGHTNESS_PROPERTY_TYPE = 'urn:miot-spec-v2:property:brightness:0000000D';
|
|
6
|
+
const MIOT_FAN_LEVEL_PROPERTY_TYPE = 'urn:miot-spec-v2:property:fan-level:00000016';
|
|
7
|
+
const MIOT_RELATIVE_HUMIDITY_PROPERTY_TYPE = 'urn:miot-spec-v2:property:relative-humidity:0000000C';
|
|
8
|
+
const MIOT_TARGET_HUMIDITY_PROPERTY_TYPE = 'urn:miot-spec-v2:property:target-humidity:00000022';
|
|
9
|
+
const MIOT_NUMERIC_FORMAT_RANGES = {
|
|
10
|
+
float: undefined,
|
|
11
|
+
int8: [-128, 127],
|
|
12
|
+
int16: [-32768, 32767],
|
|
13
|
+
int32: [-2147483648, 2147483647],
|
|
14
|
+
uint8: [0, 255],
|
|
15
|
+
uint16: [0, 65535],
|
|
16
|
+
uint32: [0, 4294967295],
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A desired MIoT state expressed through aliases in resolved connection
|
|
20
|
+
* metadata. Property addresses and numeric conventions come from the matched
|
|
21
|
+
* MIoT spec rather than a second effect-specific schema.
|
|
22
|
+
*/
|
|
23
|
+
export class MiotCommandEffect {
|
|
24
|
+
constructor(connection, values) {
|
|
25
|
+
Object.defineProperty(this, "properties", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: void 0
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(this, "connection", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: void 0
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(this, "observationRevisions", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: void 0
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(this, "observationRevisionValue", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true,
|
|
47
|
+
value: 0
|
|
48
|
+
});
|
|
49
|
+
const { metadata } = connection;
|
|
50
|
+
const entries = Object.entries(values);
|
|
51
|
+
if (entries.length === 0) {
|
|
52
|
+
throw new TypeError('A MIoT command effect must contain a value.');
|
|
53
|
+
}
|
|
54
|
+
this.properties = entries
|
|
55
|
+
.map(([name, value]) => {
|
|
56
|
+
if (value === undefined) {
|
|
57
|
+
throw new TypeError(`MIoT command effect value is undefined: ${name}.`);
|
|
58
|
+
}
|
|
59
|
+
const { service, property } = getMiotEndpointConnectionProperty(metadata, name);
|
|
60
|
+
return {
|
|
61
|
+
name,
|
|
62
|
+
property,
|
|
63
|
+
address: {
|
|
64
|
+
did: metadata.device.did,
|
|
65
|
+
siid: service.iid,
|
|
66
|
+
piid: property.iid,
|
|
67
|
+
},
|
|
68
|
+
value: canonicalizeMiotEffectValue(property, value),
|
|
69
|
+
};
|
|
70
|
+
})
|
|
71
|
+
.toSorted(compareMiotCommandEffectProperties);
|
|
72
|
+
this.connection = connection;
|
|
73
|
+
this.observationRevisions = this.getPropertyObservationRevisions();
|
|
74
|
+
}
|
|
75
|
+
get observationRevision() {
|
|
76
|
+
const observationRevisions = this.getPropertyObservationRevisions();
|
|
77
|
+
if (observationRevisions.every((revision, index) => {
|
|
78
|
+
const previousRevision = this.observationRevisions[index];
|
|
79
|
+
return previousRevision !== undefined && revision > previousRevision;
|
|
80
|
+
})) {
|
|
81
|
+
this.observationRevisions = observationRevisions;
|
|
82
|
+
this.observationRevisionValue++;
|
|
83
|
+
}
|
|
84
|
+
return this.observationRevisionValue;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The request represented by a single-property effect.
|
|
88
|
+
*
|
|
89
|
+
* Multi-property effects are valid for equality and state matching, but
|
|
90
|
+
* their external execution must be defined explicitly instead of being
|
|
91
|
+
* silently expanded into non-atomic sequential writes.
|
|
92
|
+
*/
|
|
93
|
+
get request() {
|
|
94
|
+
const [property] = this.properties;
|
|
95
|
+
if (property === undefined || this.properties.length !== 1) {
|
|
96
|
+
throw new TypeError('A multi-property MIoT effect does not define one property request.');
|
|
97
|
+
}
|
|
98
|
+
if (!property.property.access.includes('write')) {
|
|
99
|
+
throw new CommandError(`MIoT command effect property is not writable: ${property.name}.`);
|
|
100
|
+
}
|
|
101
|
+
return new MiotSetPropertyRequest(property.address, property.value);
|
|
102
|
+
}
|
|
103
|
+
/** Describes the canonical values that this effect writes to the device. */
|
|
104
|
+
toLogString() {
|
|
105
|
+
return this.properties
|
|
106
|
+
.map(({ name, property, value }) => {
|
|
107
|
+
var _a;
|
|
108
|
+
const enumName = property.enum === undefined
|
|
109
|
+
? undefined
|
|
110
|
+
: (_a = Object.entries(property.enum).find(([, enumValue]) => enumValue === value)) === null || _a === void 0 ? void 0 : _a[0];
|
|
111
|
+
return `set ${name}=${value}${enumName === undefined ? '' : ` (${enumName})`}`;
|
|
112
|
+
})
|
|
113
|
+
.join(' ');
|
|
114
|
+
}
|
|
115
|
+
equals(effect) {
|
|
116
|
+
if (!(effect instanceof MiotCommandEffect)) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
return miotCommandEffectPropertiesEqual(this.properties, effect.properties);
|
|
120
|
+
}
|
|
121
|
+
matches(_endpoint) {
|
|
122
|
+
for (const target of this.properties) {
|
|
123
|
+
const value = this.connection.getCommandEffectState(target.name);
|
|
124
|
+
if (value === undefined ||
|
|
125
|
+
canonicalizeMiotObservedEffectValue(target.name, target.property, value) !== target.value) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
getPropertyObservationRevisions() {
|
|
132
|
+
return this.properties.map(property => this.connection.getObservationRevision([property.name]));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function canonicalizeMiotEffectValue(property, value) {
|
|
136
|
+
const miotValue = getMiotEffectValue(property, value);
|
|
137
|
+
const valueList = property['value-list'];
|
|
138
|
+
if (valueList !== undefined &&
|
|
139
|
+
isValidMiotSpecValueList(valueList) &&
|
|
140
|
+
!valueList.some(entry => entry.value === miotValue)) {
|
|
141
|
+
throw new CommandError(`Unsupported MIoT property value: ${miotValue}.`);
|
|
142
|
+
}
|
|
143
|
+
return canonicalizeMiotObservedValue(property, miotValue);
|
|
144
|
+
}
|
|
145
|
+
function canonicalizeMiotObservedEffectValue(name, property, value) {
|
|
146
|
+
const canonicalValue = canonicalizeMiotObservedValue(property, value);
|
|
147
|
+
if (property.enum !== undefined &&
|
|
148
|
+
(typeof canonicalValue !== 'number' ||
|
|
149
|
+
!Object.values(property.enum).includes(canonicalValue))) {
|
|
150
|
+
throw new TypeError(`Unknown MIoT enum property state: ${name}=${value}.`);
|
|
151
|
+
}
|
|
152
|
+
return canonicalValue;
|
|
153
|
+
}
|
|
154
|
+
function canonicalizeMiotObservedValue(property, value) {
|
|
155
|
+
const { format } = property;
|
|
156
|
+
if (format === 'bool') {
|
|
157
|
+
if (typeof value !== 'boolean') {
|
|
158
|
+
throw new TypeError('Invalid MIoT boolean command effect value.');
|
|
159
|
+
}
|
|
160
|
+
return value;
|
|
161
|
+
}
|
|
162
|
+
if (format === 'string') {
|
|
163
|
+
if (typeof value !== 'string') {
|
|
164
|
+
throw new TypeError('Invalid MIoT string command effect value.');
|
|
165
|
+
}
|
|
166
|
+
return value;
|
|
167
|
+
}
|
|
168
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
169
|
+
throw new TypeError('Invalid MIoT numeric command effect value.');
|
|
170
|
+
}
|
|
171
|
+
if (!Object.hasOwn(MIOT_NUMERIC_FORMAT_RANGES, format)) {
|
|
172
|
+
throw new TypeError(`Unsupported MIoT command effect format: ${format}.`);
|
|
173
|
+
}
|
|
174
|
+
const valueList = property['value-list'];
|
|
175
|
+
if (valueList !== undefined) {
|
|
176
|
+
if (!isValidMiotSpecValueList(valueList) ||
|
|
177
|
+
!valueList.some(entry => entry.value === value)) {
|
|
178
|
+
throw new TypeError('Invalid MIoT value-list command effect value.');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const valueRange = property['value-range'];
|
|
182
|
+
const canonicalValue = valueRange === undefined
|
|
183
|
+
? value
|
|
184
|
+
: isValidMiotSpecValueRange(valueRange, format)
|
|
185
|
+
? clampAndQuantizeValue(value, valueRange)
|
|
186
|
+
: undefined;
|
|
187
|
+
if (canonicalValue === undefined) {
|
|
188
|
+
throw new TypeError('Invalid MIoT command effect value range.');
|
|
189
|
+
}
|
|
190
|
+
if (/^(?:u?int(?:8|16|32))$/.test(format) &&
|
|
191
|
+
!Number.isInteger(canonicalValue)) {
|
|
192
|
+
throw new TypeError('Invalid MIoT integer command effect value.');
|
|
193
|
+
}
|
|
194
|
+
const formatRange = MIOT_NUMERIC_FORMAT_RANGES[format];
|
|
195
|
+
if (formatRange !== undefined &&
|
|
196
|
+
(canonicalValue < formatRange[0] || canonicalValue > formatRange[1])) {
|
|
197
|
+
throw new TypeError('MIoT command effect value exceeds its format range.');
|
|
198
|
+
}
|
|
199
|
+
return canonicalValue;
|
|
200
|
+
}
|
|
201
|
+
function getMiotEffectValue(property, value) {
|
|
202
|
+
var _a;
|
|
203
|
+
if (property.enum !== undefined) {
|
|
204
|
+
if (typeof value !== 'string') {
|
|
205
|
+
throw new TypeError('Invalid MIoT enum command effect value.');
|
|
206
|
+
}
|
|
207
|
+
if (!Object.hasOwn(property.enum, value)) {
|
|
208
|
+
throw new CommandError(`Unsupported MIoT enum value: ${value}.`);
|
|
209
|
+
}
|
|
210
|
+
const enumValue = property.enum[value];
|
|
211
|
+
return enumValue;
|
|
212
|
+
}
|
|
213
|
+
if (value instanceof Temperature) {
|
|
214
|
+
switch (property.unit) {
|
|
215
|
+
case 'celsius':
|
|
216
|
+
return value.celsius;
|
|
217
|
+
case 'fahrenheit':
|
|
218
|
+
return value.fahrenheit;
|
|
219
|
+
case 'kelvin':
|
|
220
|
+
return value.kelvin;
|
|
221
|
+
default:
|
|
222
|
+
throw new TypeError(`Unsupported MIoT temperature unit: ${(_a = property.unit) !== null && _a !== void 0 ? _a : 'none'}.`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (typeof value !== 'number') {
|
|
226
|
+
return value;
|
|
227
|
+
}
|
|
228
|
+
if (matchesMiotUrnPattern(property.type, MIOT_BRIGHTNESS_PROPERTY_TYPE)) {
|
|
229
|
+
const valueRange = property['value-range'];
|
|
230
|
+
if (!isValidMiotSpecValueRange(valueRange, property.format)) {
|
|
231
|
+
throw new TypeError('Invalid MIoT brightness value range.');
|
|
232
|
+
}
|
|
233
|
+
return value * valueRange[1];
|
|
234
|
+
}
|
|
235
|
+
if (matchesMiotUrnPattern(property.type, MIOT_RELATIVE_HUMIDITY_PROPERTY_TYPE) ||
|
|
236
|
+
matchesMiotUrnPattern(property.type, MIOT_TARGET_HUMIDITY_PROPERTY_TYPE)) {
|
|
237
|
+
return value * 100;
|
|
238
|
+
}
|
|
239
|
+
if (matchesMiotUrnPattern(property.type, MIOT_FAN_LEVEL_PROPERTY_TYPE)) {
|
|
240
|
+
const valueList = property['value-list'];
|
|
241
|
+
if (!isValidMiotSpecValueList(valueList)) {
|
|
242
|
+
throw new TypeError('Invalid MIoT fan-level value list.');
|
|
243
|
+
}
|
|
244
|
+
const levels = valueList
|
|
245
|
+
.map(entry => entry.value)
|
|
246
|
+
.toSorted((a, b) => a - b);
|
|
247
|
+
const index = Math.min(levels.length - 1, Math.max(0, Math.round(value * levels.length) - 1));
|
|
248
|
+
return levels[index];
|
|
249
|
+
}
|
|
250
|
+
return value;
|
|
251
|
+
}
|
|
252
|
+
function compareMiotCommandEffectProperties(left, right) {
|
|
253
|
+
return (left.address.did.localeCompare(right.address.did) ||
|
|
254
|
+
left.address.siid - right.address.siid ||
|
|
255
|
+
left.address.piid - right.address.piid);
|
|
256
|
+
}
|
|
257
|
+
function miotCommandEffectPropertiesEqual(left, right) {
|
|
258
|
+
return (left.length === right.length &&
|
|
259
|
+
left.every((property, index) => {
|
|
260
|
+
const other = right[index];
|
|
261
|
+
return (other !== undefined &&
|
|
262
|
+
property.name === other.name &&
|
|
263
|
+
property.address.did === other.address.did &&
|
|
264
|
+
property.address.siid === other.address.siid &&
|
|
265
|
+
property.address.piid === other.address.piid &&
|
|
266
|
+
property.value === other.value);
|
|
267
|
+
}));
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=command-effect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-effect.js","sourceRoot":"","sources":["../../../src/library/devices/command-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAEZ,WAAW,GACZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAEL,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAC,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AAEvD,MAAM,6BAA6B,GACjC,+CAA+C,CAAC;AAClD,MAAM,4BAA4B,GAChC,8CAA8C,CAAC;AACjD,MAAM,oCAAoC,GACxC,sDAAsD,CAAC;AACzD,MAAM,kCAAkC,GACtC,oDAAoD,CAAC;AACvD,MAAM,0BAA0B,GAE5B;IACF,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC;IACj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J,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type CommandExecution, DehumidifierEndpoint, type DehumidifierEndpointCommand, type DehumidifierEndpointConnection, type DehumidifierMode, Temperature } from '@homelib/core';
|
|
2
|
+
import { MiotEndpointConnection } from '../endpoint-connection.js';
|
|
3
|
+
export declare class MiotDehumidifierEndpointConnection extends MiotEndpointConnection<DehumidifierEndpointCommand, typeof MiotDehumidifierEndpointConnection.properties> implements DehumidifierEndpointConnection {
|
|
4
|
+
static readonly Endpoint: typeof DehumidifierEndpoint;
|
|
5
|
+
static readonly properties: {
|
|
6
|
+
readonly 'urn:miot-spec-v2:service:dehumidifier:00007841': {
|
|
7
|
+
readonly 'urn:miot-spec-v2:property:on:00000006': "on";
|
|
8
|
+
readonly 'urn:miot-spec-v2:property:mode:00000008': {
|
|
9
|
+
readonly name: "mode";
|
|
10
|
+
readonly enum: {
|
|
11
|
+
readonly '*': {
|
|
12
|
+
readonly auto: 0;
|
|
13
|
+
readonly sleep: 1;
|
|
14
|
+
readonly laundry: 2;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
readonly optional: true;
|
|
18
|
+
};
|
|
19
|
+
readonly 'urn:miot-spec-v2:property:target-humidity:00000022': {
|
|
20
|
+
readonly name: "target-humidity";
|
|
21
|
+
readonly optional: true;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
readonly 'urn:miot-spec-v2:service:environment:0000780A': {
|
|
25
|
+
readonly 'urn:miot-spec-v2:property:temperature:00000020': {
|
|
26
|
+
readonly name: "temperature";
|
|
27
|
+
readonly optional: true;
|
|
28
|
+
};
|
|
29
|
+
readonly 'urn:miot-spec-v2:property:relative-humidity:0000000C': {
|
|
30
|
+
readonly name: "relative-humidity";
|
|
31
|
+
readonly optional: true;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
get on(): boolean;
|
|
36
|
+
get mode(): DehumidifierMode | undefined;
|
|
37
|
+
get targetRelativeHumidity(): number | undefined;
|
|
38
|
+
get temperature(): Temperature | undefined;
|
|
39
|
+
get relativeHumidity(): number | undefined;
|
|
40
|
+
prepareCommand(command: DehumidifierEndpointCommand): CommandExecution;
|
|
41
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { CommandError, DehumidifierEndpoint, SetDehumidifierModeCommand, SetDehumidifierOnCommand, SetDehumidifierTargetHumidityCommand, Temperature, } from '@homelib/core';
|
|
3
|
+
import { computed } from 'mobx';
|
|
4
|
+
import { MiotEndpointConnection } from '../endpoint-connection.js';
|
|
5
|
+
import { MiotCommandEffect } from './command-effect.js';
|
|
6
|
+
let MiotDehumidifierEndpointConnection = (() => {
|
|
7
|
+
var _a;
|
|
8
|
+
let _classSuper = MiotEndpointConnection;
|
|
9
|
+
let _instanceExtraInitializers = [];
|
|
10
|
+
let _get_on_decorators;
|
|
11
|
+
let _get_mode_decorators;
|
|
12
|
+
let _get_targetRelativeHumidity_decorators;
|
|
13
|
+
let _get_temperature_decorators;
|
|
14
|
+
let _get_relativeHumidity_decorators;
|
|
15
|
+
return _a = class MiotDehumidifierEndpointConnection extends _classSuper {
|
|
16
|
+
get on() {
|
|
17
|
+
return this.getBooleanPropertyState('on', false);
|
|
18
|
+
}
|
|
19
|
+
get mode() {
|
|
20
|
+
return this.getEnumPropertyState('mode');
|
|
21
|
+
}
|
|
22
|
+
get targetRelativeHumidity() {
|
|
23
|
+
const value = this.getNumberPropertyState('target-humidity', 0);
|
|
24
|
+
return value === undefined ? undefined : value / 100;
|
|
25
|
+
}
|
|
26
|
+
get temperature() {
|
|
27
|
+
return this.getTemperaturePropertyState('temperature', Temperature.fromKelvin(0));
|
|
28
|
+
}
|
|
29
|
+
get relativeHumidity() {
|
|
30
|
+
const value = this.getNumberPropertyState('relative-humidity', 0);
|
|
31
|
+
return value === undefined ? undefined : value / 100;
|
|
32
|
+
}
|
|
33
|
+
prepareCommand(command) {
|
|
34
|
+
let effect;
|
|
35
|
+
if (command instanceof SetDehumidifierOnCommand) {
|
|
36
|
+
effect = new MiotDehumidifierCommandEffect(this, { on: command.value });
|
|
37
|
+
}
|
|
38
|
+
else if (command instanceof SetDehumidifierModeCommand) {
|
|
39
|
+
if (this.properties.mode === undefined) {
|
|
40
|
+
throw new CommandError('MIoT dehumidifier does not support mode.');
|
|
41
|
+
}
|
|
42
|
+
effect = new MiotDehumidifierCommandEffect(this, {
|
|
43
|
+
mode: command.value,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else if (command instanceof SetDehumidifierTargetHumidityCommand) {
|
|
47
|
+
if (this.properties['target-humidity'] === undefined) {
|
|
48
|
+
throw new CommandError('MIoT dehumidifier does not support target humidity.');
|
|
49
|
+
}
|
|
50
|
+
effect = new MiotDehumidifierCommandEffect(this, {
|
|
51
|
+
'target-humidity': command.relativeHumidity,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
throw new TypeError('Unsupported MIoT dehumidifier endpoint command.');
|
|
56
|
+
}
|
|
57
|
+
const { request } = effect;
|
|
58
|
+
return {
|
|
59
|
+
effect,
|
|
60
|
+
execute: () => this.executeRequest(request),
|
|
61
|
+
toLogString: () => effect.toLogString(),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
constructor() {
|
|
65
|
+
super(...arguments);
|
|
66
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
(() => {
|
|
70
|
+
var _b;
|
|
71
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
|
|
72
|
+
_get_on_decorators = [computed];
|
|
73
|
+
_get_mode_decorators = [computed];
|
|
74
|
+
_get_targetRelativeHumidity_decorators = [computed];
|
|
75
|
+
_get_temperature_decorators = [computed];
|
|
76
|
+
_get_relativeHumidity_decorators = [computed];
|
|
77
|
+
__esDecorate(_a, null, _get_on_decorators, { kind: "getter", name: "on", static: false, private: false, access: { has: obj => "on" in obj, get: obj => obj.on }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
78
|
+
__esDecorate(_a, null, _get_mode_decorators, { kind: "getter", name: "mode", static: false, private: false, access: { has: obj => "mode" in obj, get: obj => obj.mode }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
79
|
+
__esDecorate(_a, null, _get_targetRelativeHumidity_decorators, { kind: "getter", name: "targetRelativeHumidity", static: false, private: false, access: { has: obj => "targetRelativeHumidity" in obj, get: obj => obj.targetRelativeHumidity }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
80
|
+
__esDecorate(_a, null, _get_temperature_decorators, { kind: "getter", name: "temperature", static: false, private: false, access: { has: obj => "temperature" in obj, get: obj => obj.temperature }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
81
|
+
__esDecorate(_a, null, _get_relativeHumidity_decorators, { kind: "getter", name: "relativeHumidity", static: false, private: false, access: { has: obj => "relativeHumidity" in obj, get: obj => obj.relativeHumidity }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
82
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
83
|
+
})(),
|
|
84
|
+
Object.defineProperty(_a, "Endpoint", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
configurable: true,
|
|
87
|
+
writable: true,
|
|
88
|
+
value: DehumidifierEndpoint
|
|
89
|
+
}),
|
|
90
|
+
Object.defineProperty(_a, "properties", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
configurable: true,
|
|
93
|
+
writable: true,
|
|
94
|
+
value: {
|
|
95
|
+
'urn:miot-spec-v2:service:dehumidifier:00007841': {
|
|
96
|
+
'urn:miot-spec-v2:property:on:00000006': 'on',
|
|
97
|
+
'urn:miot-spec-v2:property:mode:00000008': {
|
|
98
|
+
name: 'mode',
|
|
99
|
+
enum: { '*': { auto: 0, sleep: 1, laundry: 2 } },
|
|
100
|
+
optional: true,
|
|
101
|
+
},
|
|
102
|
+
'urn:miot-spec-v2:property:target-humidity:00000022': {
|
|
103
|
+
name: 'target-humidity',
|
|
104
|
+
optional: true,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
'urn:miot-spec-v2:service:environment:0000780A': {
|
|
108
|
+
'urn:miot-spec-v2:property:temperature:00000020': {
|
|
109
|
+
name: 'temperature',
|
|
110
|
+
optional: true,
|
|
111
|
+
},
|
|
112
|
+
'urn:miot-spec-v2:property:relative-humidity:0000000C': {
|
|
113
|
+
name: 'relative-humidity',
|
|
114
|
+
optional: true,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
}),
|
|
119
|
+
_a;
|
|
120
|
+
})();
|
|
121
|
+
export { MiotDehumidifierEndpointConnection };
|
|
122
|
+
class MiotDehumidifierCommandEffect extends MiotCommandEffect {
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=dehumidifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dehumidifier.js","sourceRoot":"","sources":["../../../src/library/devices/dehumidifier.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EAEZ,oBAAoB,EAIpB,0BAA0B,EAC1B,wBAAwB,EACxB,oCAAoC,EACpC,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,QAAQ,EAAC,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAC,sBAAsB,EAAC,MAAM,2BAA2B,CAAC;AAMjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;IAEzC,kCAAkC;;sBACrC,sBAAsB;;;;;;;sBADnB,kCACX,SAAQ,WAGP;YA8BD,IAAI,EAAE;gBACJ,OAAO,IAAI,CAAC,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACnD,CAAC;YAGD,IAAI,IAAI;gBACN,OAAO,IAAI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AQ,EAAE,IAAI;qBACf;oBACD,sDAAsD,EAAE;wBACtD,IAAI,EAAE,mBAAmB;wBACzB,QAAQ,EAAE,IAAI;qBACf;iBACF;aACoC;UAAC;;;SA/B7B,kCAAkC;AA0G/C,MAAM,6BAA8B,SAAQ,iBAE3C;CAAG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type CommandExecution, FanEndpoint, type FanEndpointCommand, type FanEndpointConnection, type FanMode } from '@homelib/core';
|
|
2
|
+
import { MiotEndpointConnection } from '../endpoint-connection.js';
|
|
3
|
+
export declare class MiotFanEndpointConnection extends MiotEndpointConnection<FanEndpointCommand, typeof MiotFanEndpointConnection.properties> implements FanEndpointConnection {
|
|
4
|
+
static readonly Endpoint: typeof FanEndpoint;
|
|
5
|
+
static readonly properties: {
|
|
6
|
+
readonly 'urn:miot-spec-v2:service:fan:00007808': {
|
|
7
|
+
readonly 'urn:miot-spec-v2:property:on:00000006': "on";
|
|
8
|
+
readonly 'urn:miot-spec-v2:property:mode:00000008': {
|
|
9
|
+
readonly name: "mode";
|
|
10
|
+
readonly enum: {
|
|
11
|
+
readonly 'urn:miot-spec-v2:device:fan:0000A005:zhimi-*': {
|
|
12
|
+
readonly natural: 0;
|
|
13
|
+
readonly normal: 1;
|
|
14
|
+
};
|
|
15
|
+
readonly '*': {
|
|
16
|
+
readonly normal: 0;
|
|
17
|
+
readonly natural: 1;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
readonly optional: true;
|
|
21
|
+
};
|
|
22
|
+
readonly 'urn:miot-spec-v2:property:fan-level:00000016': {
|
|
23
|
+
readonly name: "fan-level";
|
|
24
|
+
readonly optional: true;
|
|
25
|
+
};
|
|
26
|
+
readonly 'urn:miot-spec-v2:property:horizontal-swing:00000017': {
|
|
27
|
+
readonly name: "horizontal-swing";
|
|
28
|
+
readonly optional: true;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
get on(): boolean;
|
|
33
|
+
get mode(): FanMode | undefined;
|
|
34
|
+
get speed(): number | undefined;
|
|
35
|
+
get horizontalSwing(): boolean | undefined;
|
|
36
|
+
prepareCommand(command: FanEndpointCommand): CommandExecution;
|
|
37
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { CommandError, FanEndpoint, SetFanHorizontalSwingCommand, SetFanModeCommand, SetFanOnCommand, SetFanSpeedCommand, } from '@homelib/core';
|
|
3
|
+
import { computed } from 'mobx';
|
|
4
|
+
import { MiotEndpointConnection } from '../endpoint-connection.js';
|
|
5
|
+
import { MiotCommandEffect } from './command-effect.js';
|
|
6
|
+
let MiotFanEndpointConnection = (() => {
|
|
7
|
+
var _a;
|
|
8
|
+
let _classSuper = MiotEndpointConnection;
|
|
9
|
+
let _instanceExtraInitializers = [];
|
|
10
|
+
let _get_on_decorators;
|
|
11
|
+
let _get_mode_decorators;
|
|
12
|
+
let _get_speed_decorators;
|
|
13
|
+
let _get_horizontalSwing_decorators;
|
|
14
|
+
return _a = class MiotFanEndpointConnection extends _classSuper {
|
|
15
|
+
get on() {
|
|
16
|
+
return this.getBooleanPropertyState('on', false);
|
|
17
|
+
}
|
|
18
|
+
get mode() {
|
|
19
|
+
return this.getEnumPropertyState('mode');
|
|
20
|
+
}
|
|
21
|
+
get speed() {
|
|
22
|
+
const fanLevel = this.properties['fan-level'];
|
|
23
|
+
if (fanLevel === undefined) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const valueList = this.getPropertyValueList(fanLevel);
|
|
27
|
+
const levels = valueList
|
|
28
|
+
.map(entry => entry.value)
|
|
29
|
+
.toSorted((left, right) => left - right);
|
|
30
|
+
const value = this.getNumberPropertyState('fan-level');
|
|
31
|
+
if (value === undefined) {
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
return (levels.indexOf(value) + 1) / levels.length;
|
|
35
|
+
}
|
|
36
|
+
get horizontalSwing() {
|
|
37
|
+
return this.getBooleanPropertyState('horizontal-swing', false);
|
|
38
|
+
}
|
|
39
|
+
prepareCommand(command) {
|
|
40
|
+
let effect;
|
|
41
|
+
if (command instanceof SetFanOnCommand) {
|
|
42
|
+
effect = new MiotFanCommandEffect(this, { on: command.value });
|
|
43
|
+
}
|
|
44
|
+
else if (command instanceof SetFanModeCommand) {
|
|
45
|
+
if (this.properties.mode === undefined) {
|
|
46
|
+
throw new CommandError('MIoT fan does not support mode.');
|
|
47
|
+
}
|
|
48
|
+
effect = new MiotFanCommandEffect(this, { mode: command.value });
|
|
49
|
+
}
|
|
50
|
+
else if (command instanceof SetFanSpeedCommand) {
|
|
51
|
+
if (this.properties['fan-level'] === undefined) {
|
|
52
|
+
throw new CommandError('MIoT fan does not support speed.');
|
|
53
|
+
}
|
|
54
|
+
effect = new MiotFanCommandEffect(this, { 'fan-level': command.value });
|
|
55
|
+
}
|
|
56
|
+
else if (command instanceof SetFanHorizontalSwingCommand) {
|
|
57
|
+
if (this.properties['horizontal-swing'] === undefined) {
|
|
58
|
+
throw new CommandError('MIoT fan does not support horizontal swing.');
|
|
59
|
+
}
|
|
60
|
+
effect = new MiotFanCommandEffect(this, {
|
|
61
|
+
'horizontal-swing': command.value,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
throw new TypeError('Unsupported MIoT fan endpoint command.');
|
|
66
|
+
}
|
|
67
|
+
const { request } = effect;
|
|
68
|
+
return {
|
|
69
|
+
effect,
|
|
70
|
+
execute: () => this.executeRequest(request),
|
|
71
|
+
toLogString: () => effect.toLogString(),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
constructor() {
|
|
75
|
+
super(...arguments);
|
|
76
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
(() => {
|
|
80
|
+
var _b;
|
|
81
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_b = _classSuper[Symbol.metadata]) !== null && _b !== void 0 ? _b : null) : void 0;
|
|
82
|
+
_get_on_decorators = [computed];
|
|
83
|
+
_get_mode_decorators = [computed];
|
|
84
|
+
_get_speed_decorators = [computed];
|
|
85
|
+
_get_horizontalSwing_decorators = [computed];
|
|
86
|
+
__esDecorate(_a, null, _get_on_decorators, { kind: "getter", name: "on", static: false, private: false, access: { has: obj => "on" in obj, get: obj => obj.on }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
87
|
+
__esDecorate(_a, null, _get_mode_decorators, { kind: "getter", name: "mode", static: false, private: false, access: { has: obj => "mode" in obj, get: obj => obj.mode }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
88
|
+
__esDecorate(_a, null, _get_speed_decorators, { kind: "getter", name: "speed", static: false, private: false, access: { has: obj => "speed" in obj, get: obj => obj.speed }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
89
|
+
__esDecorate(_a, null, _get_horizontalSwing_decorators, { kind: "getter", name: "horizontalSwing", static: false, private: false, access: { has: obj => "horizontalSwing" in obj, get: obj => obj.horizontalSwing }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
90
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
91
|
+
})(),
|
|
92
|
+
Object.defineProperty(_a, "Endpoint", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
configurable: true,
|
|
95
|
+
writable: true,
|
|
96
|
+
value: FanEndpoint
|
|
97
|
+
}),
|
|
98
|
+
Object.defineProperty(_a, "properties", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
configurable: true,
|
|
101
|
+
writable: true,
|
|
102
|
+
value: {
|
|
103
|
+
'urn:miot-spec-v2:service:fan:00007808': {
|
|
104
|
+
'urn:miot-spec-v2:property:on:00000006': 'on',
|
|
105
|
+
'urn:miot-spec-v2:property:mode:00000008': {
|
|
106
|
+
name: 'mode',
|
|
107
|
+
enum: {
|
|
108
|
+
'urn:miot-spec-v2:device:fan:0000A005:zhimi-*': {
|
|
109
|
+
natural: 0,
|
|
110
|
+
normal: 1,
|
|
111
|
+
},
|
|
112
|
+
'*': {
|
|
113
|
+
normal: 0,
|
|
114
|
+
natural: 1,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
optional: true,
|
|
118
|
+
},
|
|
119
|
+
'urn:miot-spec-v2:property:fan-level:00000016': {
|
|
120
|
+
name: 'fan-level',
|
|
121
|
+
optional: true,
|
|
122
|
+
},
|
|
123
|
+
'urn:miot-spec-v2:property:horizontal-swing:00000017': {
|
|
124
|
+
name: 'horizontal-swing',
|
|
125
|
+
optional: true,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
}),
|
|
130
|
+
_a;
|
|
131
|
+
})();
|
|
132
|
+
export { MiotFanEndpointConnection };
|
|
133
|
+
class MiotFanCommandEffect extends MiotCommandEffect {
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=fan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fan.js","sourceRoot":"","sources":["../../../src/library/devices/fan.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,YAAY,EAEZ,WAAW,EAIX,4BAA4B,EAC5B,iBAAiB,EACjB,eAAe,EACf,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,QAAQ,EAAC,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAC,sBAAsB,EAAC,MAAM,2BAA2B,CAAC;AAMjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;IAEzC,yBAAyB;;sBAC5B,sBAAsB;;;;;;sBADnB,yBACX,SAAQ,WAGP;YAiCD,IAAI,EAAE;gBACJ,OAAO,IAAI,CAAC,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACnD,CAAC;YAGD,IAAI,IAAI;gBACN,OAAO,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;YAC3C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AAW;UAAC;QACvB;;;;mBAAa;gBAC3B,uCAAuC,EAAE;oBACvC,uCAAuC,EAAE,IAAI;oBAC7C,yCAAyC,EAAE;wBACzC,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;4BACJ,8CAA8C,EAAE;gCAC9C,OAAO,EAAE,CAAC;gCACV,MAAM,EAAE,CAAC;6BACV;4BACD,GAAG,EAAE;gCACH,MAAM,EAAE,CAAC;gCACT,OAAO,EAAE,CAAC;6BACX;yBACF;wBACD,QAAQ,EAAE,IAAI;qBACf;oBACD,8CAA8C,EAAE;wBAC9C,IAAI,EAAE,WAAW;wBACjB,QAAQ,EAAE,IAAI;qBACf;oBACD,qDAAqD,EAAE;wBACrD,IAAI,EAAE,kBAAkB;wBACxB,QAAQ,EAAE,IAAI;qBACf;iBACF;aACoC;UAAC;;;SAlC7B,yBAAyB;AAmHtC,MAAM,oBAAqB,SAAQ,iBAElC;CAAG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './air-conditioner.js';
|
|
2
|
+
export * from './command-effect.js';
|
|
3
|
+
export * from './dehumidifier.js';
|
|
4
|
+
export * from './fan.js';
|
|
5
|
+
export * from './light.js';
|
|
6
|
+
export * from './pet-feeder.js';
|
|
7
|
+
export * from './placeholder.js';
|
|
8
|
+
export * from './temperature-humidity-sensor.js';
|
|
9
|
+
export * from './value-range.js';
|