homebridge-midea-platform 1.2.6-beta.2 → 1.2.6-beta.21

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.
Files changed (58) hide show
  1. package/.luarc.json +5 -0
  2. package/CHANGELOG.md +3 -0
  3. package/README.md +1 -1
  4. package/ac_00000Q11.lua +5148 -0
  5. package/biome.json +1 -1
  6. package/c3_HeatPump_152832116442666.lua +4681 -0
  7. package/cd_RSJ000CB.lua +4983 -0
  8. package/config.schema.json +66 -2
  9. package/dist/accessory/AccessoryFactory.d.ts +4 -3
  10. package/dist/accessory/AccessoryFactory.js +3 -0
  11. package/dist/accessory/AccessoryFactory.js.map +1 -1
  12. package/dist/accessory/AirConditionerAccessory.js +64 -63
  13. package/dist/accessory/AirConditionerAccessory.js.map +1 -1
  14. package/dist/accessory/BaseAccessory.d.ts +2 -0
  15. package/dist/accessory/BaseAccessory.js +14 -0
  16. package/dist/accessory/BaseAccessory.js.map +1 -1
  17. package/dist/accessory/DehumidifierAccessory.js +23 -18
  18. package/dist/accessory/DehumidifierAccessory.js.map +1 -1
  19. package/dist/accessory/ElectricWaterHeaterAccessory.js +9 -8
  20. package/dist/accessory/ElectricWaterHeaterAccessory.js.map +1 -1
  21. package/dist/accessory/GasWaterHeaterAccessory.js +20 -20
  22. package/dist/accessory/GasWaterHeaterAccessory.js.map +1 -1
  23. package/dist/accessory/HeatPumpWaterHeaterAccessory.d.ts +45 -0
  24. package/dist/accessory/HeatPumpWaterHeaterAccessory.js +167 -0
  25. package/dist/accessory/HeatPumpWaterHeaterAccessory.js.map +1 -0
  26. package/dist/core/MideaCloud.js +2 -2
  27. package/dist/core/MideaCloud.js.map +1 -1
  28. package/dist/core/MideaConstants.d.ts +1 -0
  29. package/dist/core/MideaConstants.js +2 -0
  30. package/dist/core/MideaConstants.js.map +1 -1
  31. package/dist/devices/DeviceFactory.d.ts +2 -1
  32. package/dist/devices/DeviceFactory.js +5 -2
  33. package/dist/devices/DeviceFactory.js.map +1 -1
  34. package/dist/devices/ac/MideaACMessage.js +1 -1
  35. package/dist/devices/ac/MideaACMessage.js.map +1 -1
  36. package/dist/devices/c3/MideaC3Device.d.ts +3 -2
  37. package/dist/devices/c3/MideaC3Device.js +20 -7
  38. package/dist/devices/c3/MideaC3Device.js.map +1 -1
  39. package/dist/devices/c3/MideaC3Message.d.ts +128 -12
  40. package/dist/devices/c3/MideaC3Message.js +283 -35
  41. package/dist/devices/c3/MideaC3Message.js.map +1 -1
  42. package/dist/devices/cd/MideaCDDevice.d.ts +42 -0
  43. package/dist/devices/cd/MideaCDDevice.js +105 -0
  44. package/dist/devices/cd/MideaCDDevice.js.map +1 -0
  45. package/dist/devices/cd/MideaCDMessage.d.ts +101 -0
  46. package/dist/devices/cd/MideaCDMessage.js +237 -0
  47. package/dist/devices/cd/MideaCDMessage.js.map +1 -0
  48. package/dist/devices/ce/MideaCEDevice.js +1 -1
  49. package/dist/platform.d.ts +3 -0
  50. package/dist/platform.js +0 -11
  51. package/dist/platform.js.map +1 -1
  52. package/dist/platformUtils.d.ts +11 -0
  53. package/dist/platformUtils.js +10 -0
  54. package/dist/platformUtils.js.map +1 -1
  55. package/docs/download_lua.md +3 -2
  56. package/homebridge-ui/public/index.html +57 -7
  57. package/homebridge-ui/server.js +94 -146
  58. package/package.json +1 -1
@@ -1,11 +1,37 @@
1
1
  import { MessageBody, MessageRequest, MessageResponse, MessageType } from '../../core/MideaMessage.js';
2
+ export declare enum SilentLevel {
3
+ OFF = 0,
4
+ SILENT = 1,
5
+ SUPER_SILENT = 3
6
+ }
2
7
  declare abstract class MessageC3Base extends MessageRequest {
3
8
  constructor(device_protocol_version: number, message_type: MessageType, body_type: number);
4
9
  }
5
10
  export declare class MessageQuery extends MessageC3Base {
6
- constructor(device_protocol_version: number);
11
+ constructor(device_protocol_version: number, body_type: number);
7
12
  get _body(): Buffer;
8
13
  }
14
+ export declare class MessageQueryBasic extends MessageQuery {
15
+ constructor(device_protocol_version: number);
16
+ }
17
+ export declare class MessageQuerySilence extends MessageQuery {
18
+ constructor(device_protocol_version: number);
19
+ }
20
+ export declare class MessageQueryECO extends MessageQuery {
21
+ constructor(device_protocol_version: number);
22
+ }
23
+ export declare class MessageQueryInstall extends MessageQuery {
24
+ constructor(device_protocol_version: number);
25
+ }
26
+ export declare class MessageQueryDisinfect extends MessageQuery {
27
+ constructor(device_protocol_version: number);
28
+ }
29
+ export declare class MessageQueryUnitPara extends MessageQuery {
30
+ constructor(device_protocol_version: number);
31
+ }
32
+ export declare class MessageQueryHMIPara extends MessageQuery {
33
+ constructor(device_protocol_version: number);
34
+ }
9
35
  export declare class MessageSet extends MessageC3Base {
10
36
  [key: string]: any;
11
37
  zone1_power: boolean;
@@ -17,7 +43,6 @@ export declare class MessageSet extends MessageC3Base {
17
43
  room_target_temperature: number;
18
44
  zone1_curve: boolean;
19
45
  zone2_curve: boolean;
20
- disinfect: boolean;
21
46
  fast_dhw: boolean;
22
47
  tbh: boolean;
23
48
  constructor(device_protocol_version: number);
@@ -25,8 +50,7 @@ export declare class MessageSet extends MessageC3Base {
25
50
  }
26
51
  export declare class MessageSetSilent extends MessageC3Base {
27
52
  [key: string]: any;
28
- silent_mode: boolean;
29
- super_silent: boolean;
53
+ silent_level: SilentLevel;
30
54
  constructor(device_protocol_version: number);
31
55
  get _body(): Buffer;
32
56
  }
@@ -36,23 +60,38 @@ export declare class MessageSetECO extends MessageC3Base {
36
60
  constructor(device_protocol_version: number);
37
61
  get _body(): Buffer;
38
62
  }
39
- export declare class C3MessageBody extends MessageBody {
63
+ export declare class MessageSetDisinfect extends MessageC3Base {
64
+ [key: string]: any;
65
+ disinfect: boolean;
66
+ constructor(device_protocol_version: number);
67
+ get _body(): Buffer;
68
+ }
69
+ export declare class C3BasicMessageBody extends MessageBody {
40
70
  zone1_power: boolean;
41
71
  zone2_power: boolean;
42
72
  dhw_power: boolean;
43
73
  zone1_curve: boolean;
44
74
  zone2_curve: boolean;
45
- disinfect: boolean;
46
75
  tbh: boolean;
47
76
  fast_dhw: boolean;
77
+ remote_onoff: boolean;
78
+ heat: boolean;
79
+ cool: boolean;
80
+ dhw: boolean;
81
+ double_zone: boolean;
48
82
  zone_temperature_type: boolean[];
83
+ room_thermal_support: boolean;
84
+ room_thermal_state: boolean;
85
+ time_set: boolean;
49
86
  silent_mode: boolean;
87
+ holiday_on: boolean;
50
88
  eco_mode: boolean;
89
+ zone_terminal_type: number;
51
90
  mode: number;
52
91
  mode_auto: number;
53
- zone_target_temp: number[];
54
- dhw_target_temp: number;
55
- room_target_temp: number;
92
+ zone_target_temperature: number[];
93
+ dhw_target_temperature: number;
94
+ room_target_temperature: number;
56
95
  zone_heating_temperature_max: number[];
57
96
  zone_heating_temperature_min: number[];
58
97
  zone_cooling_temperature_max: number[];
@@ -63,16 +102,93 @@ export declare class C3MessageBody extends MessageBody {
63
102
  dhw_temperature_min: number;
64
103
  tank_actual_temperature: number;
65
104
  error_code: number;
105
+ tbh_control: boolean;
106
+ sys_energy_ana_en: boolean;
107
+ hmi_energy_ana_set_en: boolean;
66
108
  constructor(body: Buffer, data_offset?: number);
67
109
  }
68
- export declare class C3Notify1MessageBody extends MessageBody {
69
- status_tbh: boolean;
110
+ export declare class C3EnergyMessageBody extends MessageBody {
111
+ status_heating: boolean;
112
+ status_cool: boolean;
70
113
  status_dhw: boolean;
114
+ status_tbh: boolean;
71
115
  status_ibh: boolean;
72
- status_heating: boolean;
73
116
  total_energy_consumption: number;
74
117
  total_produced_energy: number;
75
118
  outdoor_temperature: number;
119
+ zone1_temperature_set: number;
120
+ zone2_temperature_set: number;
121
+ t5s: number;
122
+ tas: number;
123
+ constructor(body: Buffer, data_offset?: number);
124
+ }
125
+ export declare class C3SilenceMessageBody extends MessageBody {
126
+ silent_mode: boolean;
127
+ silent_level: SilentLevel;
128
+ constructor(body: Buffer, data_offset?: number);
129
+ }
130
+ export declare class C3ECOMessageBody extends MessageBody {
131
+ eco_function_state: boolean;
132
+ eco_timer_state: boolean;
133
+ constructor(body: Buffer, data_offset?: number);
134
+ }
135
+ export declare class C3DisinfectMessageBody extends MessageBody {
136
+ disinfect: boolean;
137
+ disinfect_run: boolean;
138
+ disinfect_set_weekday: number;
139
+ disinfect_start_hour: number;
140
+ disinfect_start_minute: number;
141
+ constructor(body: Buffer, data_offset?: number);
142
+ }
143
+ export declare class C3UnitParaMessageBody extends MessageBody {
144
+ comp_run_freq: number;
145
+ unit_mode_run: number;
146
+ fan_speed: number;
147
+ fg_capacity_need: number;
148
+ temp_t3: number;
149
+ temp_t4: number;
150
+ temp_tp: number;
151
+ temp_tw_in: number;
152
+ temp_tw_out: number;
153
+ temp_tsolar: number;
154
+ hydbox_subtype: number;
155
+ fg_usb_info_connect: number;
156
+ odu_voltage: number;
157
+ exv_current: number;
158
+ odu_model: number;
159
+ temp_t1: number;
160
+ temp_tw2: number;
161
+ temp_t2: number;
162
+ temp_t2b: number;
163
+ temp_t5: number;
164
+ temp_ta: number;
165
+ temp_tb_t1: number;
166
+ temp_tb_t2: number;
167
+ hydrobox_capacity: number;
168
+ pressure_high: number;
169
+ pressure_low: number;
170
+ temp_th: number;
171
+ machine_type: number;
172
+ odu_target_fre: number;
173
+ dc_current: number;
174
+ temp_tf: number;
175
+ idu_t1s1: number;
176
+ idu_t1s2: number;
177
+ water_flower: number;
178
+ odu_plan_vol_lmt: number;
179
+ current_unit_capacity: number;
180
+ sphera_ahs_voltage: number;
181
+ temp_t4a_ver: number;
182
+ water_pressure: number;
183
+ room_rel_hum: number;
184
+ pwm_pump_out: number;
185
+ total_electricity0: number;
186
+ total_thermal0: number;
187
+ heat_elec_total_consum0: number;
188
+ heat_elec_total_capacity0: number;
189
+ instant_power0: number;
190
+ instant_renew_power0: number;
191
+ total_renew_power0: number;
76
192
  constructor(body: Buffer, data_offset?: number);
77
193
  }
78
194
  export declare class MessageC3Response extends MessageResponse {
@@ -8,19 +8,61 @@
8
8
  */
9
9
  import { DeviceType } from '../../core/MideaConstants.js';
10
10
  import { MessageBody, MessageRequest, MessageResponse, MessageType } from '../../core/MideaMessage.js';
11
+ export var SilentLevel;
12
+ (function (SilentLevel) {
13
+ SilentLevel[SilentLevel["OFF"] = 0] = "OFF";
14
+ SilentLevel[SilentLevel["SILENT"] = 1] = "SILENT";
15
+ SilentLevel[SilentLevel["SUPER_SILENT"] = 3] = "SUPER_SILENT";
16
+ })(SilentLevel || (SilentLevel = {}));
17
+ const TEMPERATURE_NEGATIVE_VALUE = 127;
11
18
  class MessageC3Base extends MessageRequest {
12
19
  constructor(device_protocol_version, message_type, body_type) {
13
20
  super(DeviceType.HEAT_PUMP_WIFI_CONTROLLER, message_type, body_type, device_protocol_version);
14
21
  }
15
22
  }
16
23
  export class MessageQuery extends MessageC3Base {
17
- constructor(device_protocol_version) {
18
- super(device_protocol_version, MessageType.QUERY, 0x01);
24
+ constructor(device_protocol_version, body_type) {
25
+ super(device_protocol_version, MessageType.QUERY, body_type);
19
26
  }
20
27
  get _body() {
21
28
  return Buffer.alloc(0);
22
29
  }
23
30
  }
31
+ export class MessageQueryBasic extends MessageQuery {
32
+ constructor(device_protocol_version) {
33
+ super(device_protocol_version, 0x01);
34
+ }
35
+ }
36
+ export class MessageQuerySilence extends MessageQuery {
37
+ constructor(device_protocol_version) {
38
+ super(device_protocol_version, 0x05);
39
+ }
40
+ }
41
+ export class MessageQueryECO extends MessageQuery {
42
+ constructor(device_protocol_version) {
43
+ super(device_protocol_version, 0x07);
44
+ }
45
+ }
46
+ export class MessageQueryInstall extends MessageQuery {
47
+ constructor(device_protocol_version) {
48
+ super(device_protocol_version, 0x08);
49
+ }
50
+ }
51
+ export class MessageQueryDisinfect extends MessageQuery {
52
+ constructor(device_protocol_version) {
53
+ super(device_protocol_version, 0x09);
54
+ }
55
+ }
56
+ export class MessageQueryUnitPara extends MessageQuery {
57
+ constructor(device_protocol_version) {
58
+ super(device_protocol_version, 0x10);
59
+ }
60
+ }
61
+ export class MessageQueryHMIPara extends MessageQuery {
62
+ constructor(device_protocol_version) {
63
+ super(device_protocol_version, 0x0a);
64
+ }
65
+ }
24
66
  export class MessageSet extends MessageC3Base {
25
67
  zone1_power;
26
68
  zone2_power;
@@ -31,7 +73,6 @@ export class MessageSet extends MessageC3Base {
31
73
  room_target_temperature;
32
74
  zone1_curve;
33
75
  zone2_curve;
34
- disinfect;
35
76
  fast_dhw;
36
77
  tbh;
37
78
  constructor(device_protocol_version) {
@@ -45,7 +86,6 @@ export class MessageSet extends MessageC3Base {
45
86
  this.room_target_temperature = 25;
46
87
  this.zone1_curve = false;
47
88
  this.zone2_curve = false;
48
- this.disinfect = false;
49
89
  this.fast_dhw = false;
50
90
  this.tbh = false;
51
91
  }
@@ -57,7 +97,7 @@ export class MessageSet extends MessageC3Base {
57
97
  // Byte 7
58
98
  const zone1_curve = this.zone1_curve ? 0x01 : 0x00;
59
99
  const zone2_curve = this.zone2_curve ? 0x02 : 0x00;
60
- const disinfect = this.disinfect || this.tbh ? 0x04 : 0x00;
100
+ const tbh = this.tbh ? 0x04 : 0x00;
61
101
  const fast_dhw = this.fast_dhw ? 0x08 : 0x00;
62
102
  const room_target_temperature = (this.room_target_temperature * 2) | 0;
63
103
  const zone1_target_temperature = this.zone_target_temperature[0] | 0;
@@ -70,24 +110,20 @@ export class MessageSet extends MessageC3Base {
70
110
  zone2_target_temperature,
71
111
  dhw_target_temperature,
72
112
  room_target_temperature,
73
- zone1_curve | zone2_curve | disinfect | fast_dhw,
113
+ zone1_curve | zone2_curve | tbh | fast_dhw,
74
114
  ]);
75
115
  }
76
116
  }
77
117
  export class MessageSetSilent extends MessageC3Base {
78
- silent_mode;
79
- super_silent;
118
+ silent_level;
80
119
  constructor(device_protocol_version) {
81
120
  super(device_protocol_version, MessageType.SET, 0x05);
82
- this.silent_mode = false;
83
- this.super_silent = false;
121
+ this.silent_level = SilentLevel.OFF;
84
122
  }
85
123
  get _body() {
86
- const silent_mode = this.silent_mode ? 0x01 : 0x00;
87
- const super_silent = this.super_silent ? 0x02 : 0x00;
88
124
  // biome-ignore format: easier to read
89
125
  return Buffer.from([
90
- silent_mode | super_silent,
126
+ this.silent_level,
91
127
  0x00, 0x00, 0x00, 0x00,
92
128
  0x00, 0x00, 0x00, 0x00
93
129
  ]);
@@ -103,29 +139,50 @@ export class MessageSetECO extends MessageC3Base {
103
139
  const eco_mode = this.eco_mode ? 0x01 : 0x00;
104
140
  // biome-ignore format: easier to read
105
141
  return Buffer.from([
106
- eco_mode,
107
- 0x00, 0x00, 0x00, 0x00,
108
- 0x00
142
+ eco_mode, 0x00, 0x00, 0x00, 0x00, 0x00
143
+ ]);
144
+ }
145
+ }
146
+ export class MessageSetDisinfect extends MessageC3Base {
147
+ disinfect;
148
+ constructor(device_protocol_version) {
149
+ super(device_protocol_version, MessageType.SET, 0x09);
150
+ this.disinfect = false;
151
+ }
152
+ get _body() {
153
+ const disinfect = this.disinfect ? 0x01 : 0x00;
154
+ // biome-ignore format: easier to read
155
+ return Buffer.from([
156
+ disinfect, 0x00, 0x00, 0x00, 0x00,
109
157
  ]);
110
158
  }
111
159
  }
112
- export class C3MessageBody extends MessageBody {
160
+ export class C3BasicMessageBody extends MessageBody {
113
161
  zone1_power;
114
162
  zone2_power;
115
163
  dhw_power;
116
164
  zone1_curve;
117
165
  zone2_curve;
118
- disinfect;
119
- tbh;
166
+ tbh; // disinfect
120
167
  fast_dhw;
168
+ remote_onoff;
169
+ heat;
170
+ cool;
171
+ dhw;
172
+ double_zone;
121
173
  zone_temperature_type;
174
+ room_thermal_support;
175
+ room_thermal_state;
176
+ time_set;
122
177
  silent_mode;
178
+ holiday_on;
123
179
  eco_mode;
180
+ zone_terminal_type;
124
181
  mode;
125
182
  mode_auto;
126
- zone_target_temp;
127
- dhw_target_temp;
128
- room_target_temp;
183
+ zone_target_temperature;
184
+ dhw_target_temperature;
185
+ room_target_temperature;
129
186
  zone_heating_temperature_max;
130
187
  zone_heating_temperature_min;
131
188
  zone_cooling_temperature_max;
@@ -136,6 +193,9 @@ export class C3MessageBody extends MessageBody {
136
193
  dhw_temperature_min;
137
194
  tank_actual_temperature;
138
195
  error_code;
196
+ tbh_control;
197
+ sys_energy_ana_en; // SysEnergyAnaEN
198
+ hmi_energy_ana_set_en; // HMIEnergyAnaSetEN
139
199
  constructor(body, data_offset = 0) {
140
200
  super(body);
141
201
  this.zone1_power = (body[data_offset + 0] & 0x01) > 0;
@@ -143,17 +203,26 @@ export class C3MessageBody extends MessageBody {
143
203
  this.dhw_power = (body[data_offset + 0] & 0x04) > 0;
144
204
  this.zone1_curve = (body[data_offset + 0] & 0x08) > 0;
145
205
  this.zone2_curve = (body[data_offset + 0] & 0x10) > 0;
146
- this.disinfect = (body[data_offset + 0] & 0x20) > 0;
147
206
  this.tbh = (body[data_offset + 0] & 0x20) > 0;
148
207
  this.fast_dhw = (body[data_offset + 0] & 0x40) > 0;
208
+ this.remote_onoff = (body[data_offset + 0] & 0x80) > 0;
209
+ this.heat = (body[data_offset + 1] & 0x01) > 0;
210
+ this.cool = (body[data_offset + 1] & 0x02) > 0;
211
+ this.dhw = (body[data_offset + 1] & 0x04) > 0;
212
+ this.double_zone = (body[data_offset + 1] & 0x08) > 0;
149
213
  this.zone_temperature_type = [(body[data_offset + 1] & 0x10) > 0, (body[data_offset + 1] & 0x20) > 0];
214
+ this.room_thermal_support = (body[data_offset + 1] & 0x40) > 0;
215
+ this.room_thermal_state = (body[data_offset + 1] & 0x80) > 0;
216
+ this.time_set = (body[data_offset + 2] & 0x01) > 0;
150
217
  this.silent_mode = (body[data_offset + 2] & 0x02) > 0;
218
+ this.holiday_on = (body[data_offset + 2] & 0x04) > 0;
151
219
  this.eco_mode = (body[data_offset + 2] & 0x08) > 0;
220
+ this.zone_terminal_type = body[data_offset + 2];
152
221
  this.mode = body[data_offset + 3];
153
222
  this.mode_auto = body[data_offset + 4];
154
- this.zone_target_temp = [body[data_offset + 5], body[data_offset + 6]];
155
- this.dhw_target_temp = body[data_offset + 7];
156
- this.room_target_temp = body[data_offset + 8] / 2;
223
+ this.zone_target_temperature = [body[data_offset + 5], body[data_offset + 6]];
224
+ this.dhw_target_temperature = body[data_offset + 7];
225
+ this.room_target_temperature = body[data_offset + 8] / 2;
157
226
  this.zone_heating_temperature_max = [body[data_offset + 9], body[data_offset + 13]];
158
227
  this.zone_heating_temperature_min = [body[data_offset + 10], body[data_offset + 14]];
159
228
  this.zone_cooling_temperature_max = [body[data_offset + 11], body[data_offset + 15]];
@@ -164,26 +233,193 @@ export class C3MessageBody extends MessageBody {
164
233
  this.dhw_temperature_min = body[data_offset + 20];
165
234
  this.tank_actual_temperature = body[data_offset + 21];
166
235
  this.error_code = body[data_offset + 22];
236
+ this.tbh_control = (body[data_offset + 23] & 0x80) > 0;
237
+ this.sys_energy_ana_en = (body[data_offset + 23] & 0x20) > 0;
238
+ this.hmi_energy_ana_set_en = (body[data_offset + 23] & 0x40) > 0;
167
239
  }
168
240
  }
169
- export class C3Notify1MessageBody extends MessageBody {
170
- status_tbh;
241
+ export class C3EnergyMessageBody extends MessageBody {
242
+ status_heating;
243
+ status_cool;
171
244
  status_dhw;
245
+ status_tbh;
172
246
  status_ibh;
173
- status_heating;
174
247
  total_energy_consumption;
175
248
  total_produced_energy;
176
249
  outdoor_temperature;
250
+ zone1_temperature_set;
251
+ zone2_temperature_set;
252
+ t5s;
253
+ tas;
177
254
  constructor(body, data_offset = 0) {
178
255
  super(body);
179
256
  const status_byte = body[data_offset];
180
- this.status_tbh = (status_byte & 0x08) > 0;
181
- this.status_dhw = (status_byte & 0x04) > 0;
182
- this.status_ibh = (status_byte & 0x02) > 0;
183
257
  this.status_heating = (status_byte & 0x01) > 0;
258
+ this.status_cool = (status_byte & 0x02) > 0;
259
+ this.status_dhw = (status_byte & 0x04) > 0;
260
+ this.status_tbh = (status_byte & 0x08) > 0;
261
+ this.status_ibh = (status_byte & 0x10) > 0;
184
262
  this.total_energy_consumption = body.readUInt32LE(data_offset + 1);
185
263
  this.total_produced_energy = body.readUInt32LE(data_offset + 5);
186
- this.outdoor_temperature = body[data_offset + 9] | 0;
264
+ const base_value = body[data_offset + 9];
265
+ this.outdoor_temperature = base_value > TEMPERATURE_NEGATIVE_VALUE ? base_value - 256 : base_value;
266
+ this.zone1_temperature_set = body[data_offset + 10];
267
+ this.zone2_temperature_set = body[data_offset + 11];
268
+ this.t5s = body[data_offset + 12];
269
+ this.tas = body[data_offset + 13];
270
+ }
271
+ }
272
+ export class C3SilenceMessageBody extends MessageBody {
273
+ silent_mode;
274
+ silent_level;
275
+ constructor(body, data_offset = 0) {
276
+ super(body);
277
+ this.silent_mode = (body[data_offset] & 0x01) > 0;
278
+ this.silent_level = (() => {
279
+ if (!this.silent_mode)
280
+ return SilentLevel.OFF;
281
+ switch (((body[data_offset] & 0x01) + (body[data_offset] & 0x08)) >> 2) {
282
+ case 0x01:
283
+ return SilentLevel.SILENT;
284
+ case 0x03:
285
+ return SilentLevel.SUPER_SILENT;
286
+ default:
287
+ return SilentLevel.OFF;
288
+ }
289
+ })();
290
+ }
291
+ }
292
+ export class C3ECOMessageBody extends MessageBody {
293
+ eco_function_state;
294
+ eco_timer_state;
295
+ constructor(body, data_offset = 0) {
296
+ super(body);
297
+ this.eco_function_state = (body[data_offset] & 0x01) > 0;
298
+ this.eco_timer_state = (body[data_offset] & 0x02) > 0;
299
+ }
300
+ }
301
+ export class C3DisinfectMessageBody extends MessageBody {
302
+ disinfect;
303
+ disinfect_run;
304
+ disinfect_set_weekday;
305
+ disinfect_start_hour;
306
+ disinfect_start_minute;
307
+ constructor(body, data_offset = 0) {
308
+ super(body);
309
+ this.disinfect = (body[data_offset] & 0x01) > 0;
310
+ this.disinfect_run = (body[data_offset] & 0x02) > 0;
311
+ this.disinfect_set_weekday = body[data_offset + 1];
312
+ this.disinfect_start_hour = body[data_offset + 2];
313
+ this.disinfect_start_minute = body[data_offset + 3];
314
+ }
315
+ }
316
+ export class C3UnitParaMessageBody extends MessageBody {
317
+ comp_run_freq;
318
+ unit_mode_run;
319
+ fan_speed;
320
+ fg_capacity_need;
321
+ temp_t3;
322
+ temp_t4;
323
+ temp_tp;
324
+ temp_tw_in;
325
+ temp_tw_out;
326
+ temp_tsolar;
327
+ hydbox_subtype;
328
+ fg_usb_info_connect;
329
+ // usb_index_max: number;
330
+ // odu_comp_current: number;
331
+ odu_voltage;
332
+ exv_current;
333
+ odu_model;
334
+ // unit_online_num: number;
335
+ // current_code: number;
336
+ temp_t1;
337
+ temp_tw2;
338
+ temp_t2;
339
+ temp_t2b;
340
+ temp_t5;
341
+ temp_ta;
342
+ temp_tb_t1;
343
+ temp_tb_t2;
344
+ hydrobox_capacity;
345
+ pressure_high;
346
+ pressure_low;
347
+ temp_th;
348
+ machine_type;
349
+ odu_target_fre;
350
+ dc_current;
351
+ temp_tf;
352
+ idu_t1s1;
353
+ idu_t1s2;
354
+ water_flower;
355
+ odu_plan_vol_lmt;
356
+ current_unit_capacity;
357
+ sphera_ahs_voltage;
358
+ temp_t4a_ver;
359
+ water_pressure;
360
+ room_rel_hum;
361
+ pwm_pump_out;
362
+ total_electricity0;
363
+ total_thermal0;
364
+ heat_elec_total_consum0;
365
+ heat_elec_total_capacity0;
366
+ instant_power0;
367
+ instant_renew_power0;
368
+ total_renew_power0;
369
+ constructor(body, data_offset = 0) {
370
+ super(body);
371
+ this.comp_run_freq = body[data_offset];
372
+ this.unit_mode_run = body[data_offset + 1];
373
+ this.fan_speed = body[data_offset + 3] * 10;
374
+ this.fg_capacity_need = body[data_offset + 5];
375
+ this.temp_t3 = body[data_offset + 6];
376
+ this.temp_t4 = body[data_offset + 7];
377
+ this.temp_tp = body[data_offset + 8];
378
+ this.temp_tw_in = body[data_offset + 9];
379
+ this.temp_tw_out = body[data_offset + 10];
380
+ this.temp_tsolar = body[data_offset + 11];
381
+ this.hydbox_subtype = body[data_offset + 12];
382
+ this.fg_usb_info_connect = body[data_offset + 13];
383
+ // this.usb_index_max body[data_offset + 14]
384
+ // this.odu_comp_current body[data_offset + 16]
385
+ this.odu_voltage = body[data_offset + 17] * 256 + body[data_offset + 18];
386
+ this.exv_current = body[data_offset + 19] * 256 + body[data_offset + 20];
387
+ this.odu_model = body[data_offset + 21];
388
+ // this.unit_online_num body[data_offset + 22]
389
+ // this.current_code body[data_offset + 23]
390
+ this.temp_t1 = body[data_offset + 33];
391
+ this.temp_tw2 = body[data_offset + 34];
392
+ this.temp_t2 = body[data_offset + 35];
393
+ this.temp_t2b = body[data_offset + 36];
394
+ this.temp_t5 = body[data_offset + 37];
395
+ this.temp_ta = body[data_offset + 38];
396
+ this.temp_tb_t1 = body[data_offset + 39];
397
+ this.temp_tb_t2 = body[data_offset + 40];
398
+ this.hydrobox_capacity = body[data_offset + 41];
399
+ this.pressure_high = body[data_offset + 42] * 256 + body[data_offset + 43];
400
+ this.pressure_low = body[data_offset + 44] * 256 + body[data_offset + 45];
401
+ this.temp_th = body[data_offset + 46];
402
+ this.machine_type = body[data_offset + 47];
403
+ this.odu_target_fre = body[data_offset + 48];
404
+ this.dc_current = body[data_offset + 49];
405
+ this.temp_tf = body[data_offset + 51];
406
+ this.idu_t1s1 = body[data_offset + 52];
407
+ this.idu_t1s2 = body[data_offset + 53];
408
+ this.water_flower = body[data_offset + 54] * 256 + body[data_offset + 55];
409
+ this.odu_plan_vol_lmt = body[data_offset + 56];
410
+ this.current_unit_capacity = body[data_offset + 57];
411
+ this.sphera_ahs_voltage = body[data_offset + 59];
412
+ this.temp_t4a_ver = body[data_offset + 60];
413
+ this.water_pressure = body[data_offset + 61] * 256 + body[data_offset + 62];
414
+ this.room_rel_hum = body[data_offset + 63];
415
+ this.pwm_pump_out = body[data_offset + 63];
416
+ this.total_electricity0 = body.readUInt32LE(data_offset + 69);
417
+ this.total_thermal0 = body.readUInt32LE(data_offset + 73);
418
+ this.heat_elec_total_consum0 = body.readUInt32LE(data_offset + 77);
419
+ this.heat_elec_total_capacity0 = body.readUInt32LE(data_offset + 81);
420
+ this.instant_power0 = (body[data_offset + 82] << 8) + body[data_offset + 83];
421
+ this.instant_renew_power0 = (body[data_offset + 84] << 8) + body[data_offset + 85];
422
+ this.total_renew_power0 = (body[data_offset + 84] << 8) + body[data_offset + 85];
187
423
  }
188
424
  }
189
425
  export class MessageC3Response extends MessageResponse {
@@ -191,10 +427,22 @@ export class MessageC3Response extends MessageResponse {
191
427
  super(message);
192
428
  if (([MessageType.SET, MessageType.NOTIFY1, MessageType.QUERY].includes(this.message_type) && this.body_type === 0x01) ||
193
429
  this.message_type === MessageType.NOTIFY2) {
194
- this.set_body(new C3MessageBody(this.body, 1));
430
+ this.set_body(new C3BasicMessageBody(this.body, 1));
195
431
  }
196
432
  else if (this.message_type === MessageType.NOTIFY1 && this.body_type === 0x04) {
197
- this.set_body(new C3Notify1MessageBody(this.body, 1));
433
+ this.set_body(new C3EnergyMessageBody(this.body, 1));
434
+ }
435
+ else if (this.message_type === MessageType.QUERY && this.body_type === 0x05) {
436
+ this.set_body(new C3SilenceMessageBody(this.body, 1));
437
+ }
438
+ else if (this.body_type === 0x07) {
439
+ this.set_body(new C3ECOMessageBody(this.body, 1));
440
+ }
441
+ else if (this.body_type === 0x09) {
442
+ this.set_body(new C3DisinfectMessageBody(this.body, 1));
443
+ }
444
+ else if (this.body_type === 0x10) {
445
+ this.set_body(new C3UnitParaMessageBody(this.body, 1));
198
446
  }
199
447
  }
200
448
  }