homebridge-melcloud-control 4.2.3-beta.27 → 4.2.3-beta.29

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "MELCloud Control",
3
3
  "name": "homebridge-melcloud-control",
4
- "version": "4.2.3-beta.27",
4
+ "version": "4.2.3-beta.29",
5
5
  "description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/constants.js CHANGED
@@ -19,16 +19,26 @@ export const ApiUrls = {
19
19
 
20
20
  export const ApiUrlsHome = {
21
21
  BaseURL: "https://melcloudhome.com",
22
- Dashboard: "https://melcloudhome.com/dashboard",
23
22
  GetUserContext: "/api/user/context",
24
- SetAta: "/api/ataunit/deviceid",
25
- SetAtw: "/api/atwunit/deviceid",
26
- SetErv: "/api/ervunit/deviceid",
27
- PutScheduleEnable: "/api/cloudschedule/deviceid/enabled", // PUT {"enabled":true}
23
+ GetUserScenes: "/api/user/scenes",
24
+ PutAta: "/api/ataunit/deviceid",
25
+ PutAtw: "/api/atwunit/deviceid",
26
+ PutErv: "/api/ervunit/deviceid",
28
27
  PostSchedule: " /api/cloudschedule/deviceid", // POST {"days":[2],"time":"17:59:00","enabled":true,"id":"53c5e804-0663-47d0-85c2-2d8ccd2573de","power":false,"operationMode":null,"setPoint":null,"vaneVerticalDirection":null,"vaneHorizontalDirection":null,"setFanSpeed":null}
29
28
  PostProtectionFrost: "/api/protection/frost", // POST {"enabled":true,"min":13,"max":16,"units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
30
29
  PostProtectionOverheat: "api/protection/overheat", // POST {"enabled":true,"min":32,"max":35,"units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
31
- PostHolidayMode: " /api/holidaymode" // POST {"enabled":true,"startDate":"2025-11-11T17:42:24.913","endDate":"2026-06-01T09:18:00","units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
30
+ PostHolidayMode: " /api/holidaymode", // POST {"enabled":true,"startDate":"2025-11-11T17:42:24.913","endDate":"2026-06-01T09:18:00","units":{"ATA":["ef333525-2699-4290-af5a-2922566676da"]}}
31
+ PutScheduleEnabled: "/api/cloudschedule/deviceid/enabled", // PUT {"enabled":true}
32
+ PutSceneEnable: "/api/scene/sceneid/enable",
33
+ PutSceneDisable: "/api/scene/sceneid/disable",
34
+ Referers: {
35
+ GetPutScenes: "https://melcloudhome.com/scenes",
36
+ PostHolidayMode: "https://melcloudhome.com/ata/deviceid/holidaymode",
37
+ PostProtectionFrost: "https://melcloudhome.com/ata/deviceid/frostprotection",
38
+ PostProtectionOverheat: "https://melcloudhome.com/ata/deviceid/overheatprotection",
39
+ PutDeviceSettings: "https://melcloudhome.com/dashboard",
40
+ PutScheduleEnabled: "https://melcloudhome.com/ata/deviceid/schedule",
41
+ }
32
42
  };
33
43
 
34
44
  export const DeviceType = [
@@ -131,6 +131,7 @@ class MelCloudAta extends EventEmitter {
131
131
  let method = null
132
132
  let payload = {};
133
133
  let path = '';
134
+ let referer = '';
134
135
  switch (accountType) {
135
136
  case "melcloud":
136
137
 
@@ -191,6 +192,7 @@ class MelCloudAta extends EventEmitter {
191
192
  };
192
193
  method = 'POST';
193
194
  path = ApiUrlsHome.PostProtectionFrost;
195
+ referer = ApiUrlsHome.Referers.PostProtectionFrost.replace('deviceid', deviceData.DeviceID);
194
196
  break;
195
197
  case 'overheatprotection':
196
198
  payload = {
@@ -201,6 +203,7 @@ class MelCloudAta extends EventEmitter {
201
203
  };
202
204
  method = 'POST';
203
205
  path = ApiUrlsHome.PostProtectionOverheat;
206
+ referer = ApiUrlsHome.Referers.PostProtectionOverheat.replace('deviceid', deviceData.DeviceID);
204
207
  break;
205
208
  case 'holidaymode':
206
209
  payload = {
@@ -211,11 +214,13 @@ class MelCloudAta extends EventEmitter {
211
214
  };
212
215
  method = 'POST';
213
216
  path = ApiUrlsHome.PostHolidayMode;
217
+ referer = ApiUrlsHome.Referers.PostHolidayMode.replace('deviceid', deviceData.DeviceID);
214
218
  break;
215
219
  case 'schedule':
216
220
  payload = { enabled: deviceData.ScheduleEnabled };
217
221
  method = 'PUT';
218
- path = ApiUrlsHome.PutScheduleEnable.replace('deviceid', deviceData.DeviceID);
222
+ path = ApiUrlsHome.PutScheduleEnabled.replace('deviceid', deviceData.DeviceID);
223
+ referer = ApiUrlsHome.Referers.PutScheduleEnabled.replace('deviceid', deviceData.DeviceID);
219
224
  break;
220
225
  default:
221
226
  payload = {
@@ -227,10 +232,12 @@ class MelCloudAta extends EventEmitter {
227
232
  VaneVerticalDirection: AirConditioner.VaneVerticalDirectionMapEnumToString[deviceData.Device.VaneVerticalDirection],
228
233
  };
229
234
  method = 'PUT';
230
- path = ApiUrlsHome.SetAta.replace('deviceid', deviceData.DeviceID);
235
+ path = ApiUrlsHome.PutAta.replace('deviceid', deviceData.DeviceID);
236
+ referer = ApiUrlsHome.Referers.PutDeviceSettings
231
237
  break
232
238
  }
233
239
 
240
+ deviceData.Headers.Referer = referer;
234
241
  if (!this.logDebug) this.emit('warn', `Send Data: ${JSON.stringify(deviceData, null, 2)}`);
235
242
  await axios(path, {
236
243
  method: method,