homey-api 3.0.0-rc.1 → 3.0.0-rc.2
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/lib/HomeyAPI/HomeyAPI.js +7 -6
- package/package.json +1 -1
package/lib/HomeyAPI/HomeyAPI.js
CHANGED
|
@@ -139,10 +139,6 @@ class HomeyAPI {
|
|
|
139
139
|
throw new Error('Invalid Homey');
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
if (homey.platform !== 'local') {
|
|
143
|
-
throw new Error(`Invalid Homey Platform: ${homey.platform}`);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
142
|
const props = {
|
|
147
143
|
debug,
|
|
148
144
|
token: await homey.api.getOwnerApiToken(),
|
|
@@ -154,16 +150,21 @@ class HomeyAPI {
|
|
|
154
150
|
},
|
|
155
151
|
};
|
|
156
152
|
|
|
157
|
-
if (homey.platformVersion === 1) {
|
|
153
|
+
if (homey.platform === 'local' && homey.platformVersion === 1) {
|
|
158
154
|
const HomeyAPIV2 = require('./HomeyAPIV2');
|
|
159
155
|
return new HomeyAPIV2(props);
|
|
160
156
|
}
|
|
161
157
|
|
|
162
|
-
if (homey.platformVersion === 2) {
|
|
158
|
+
if (homey.platform === 'local' && homey.platformVersion === 2) {
|
|
163
159
|
const HomeyAPIV3Local = require('./HomeyAPIV3Local');
|
|
164
160
|
return new HomeyAPIV3Local(props);
|
|
165
161
|
}
|
|
166
162
|
|
|
163
|
+
if (homey.platform === 'cloud' && homey.platformVersion === 2) {
|
|
164
|
+
const HomeyAPIV3Cloud = require('./HomeyAPIV3Cloud');
|
|
165
|
+
return new HomeyAPIV3Cloud(props);
|
|
166
|
+
}
|
|
167
|
+
|
|
167
168
|
throw new Error(`Invalid Homey Platform Version: ${homey.platformVersion}`);
|
|
168
169
|
}
|
|
169
170
|
|