tsvesync 1.0.68 → 1.0.69

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.
@@ -42,6 +42,11 @@ export declare class VeSyncHumid200300S extends VeSyncHumidifier {
42
42
  * Get night light brightness
43
43
  */
44
44
  get nightLightBrightness(): number;
45
+ /**
46
+ * Return JSON details for humidifier
47
+ * Override to include current humidity and target humidity
48
+ */
49
+ displayJSON(): string;
45
50
  /**
46
51
  * Set night light brightness
47
52
  */
@@ -20,7 +20,7 @@ class VeSyncHumid200300S extends humidifier_1.VeSyncHumidifier {
20
20
  * Get device details
21
21
  */
22
22
  async getDetails() {
23
- var _a, _b, _c;
23
+ var _a, _b, _c, _d;
24
24
  logger_1.logger.debug(`Getting details for device: ${this.deviceName}`);
25
25
  const [response, status] = await this.callApi('/cloud/v2/deviceManaged/bypassV2', 'post', {
26
26
  ...helpers_1.Helpers.reqBody(this.manager, 'bypassV2'),
@@ -40,7 +40,7 @@ class VeSyncHumid200300S extends humidifier_1.VeSyncHumidifier {
40
40
  this.details = {
41
41
  mode: result.mode || '',
42
42
  humidity: result.humidity || 0, // Current humidity
43
- target_humidity: result.target_humidity || result.humidity || 0, // Target humidity
43
+ target_humidity: ((_b = result.configuration) === null || _b === void 0 ? void 0 : _b.auto_target_humidity) || result.target_humidity || 0, // Target humidity from configuration
44
44
  mist_level: result.mist_level || 0,
45
45
  mist_virtual_level: result.mist_virtual_level || 0,
46
46
  water_lacks: result.water_lacks || false,
@@ -48,8 +48,8 @@ class VeSyncHumid200300S extends humidifier_1.VeSyncHumidifier {
48
48
  water_tank_lifted: result.water_tank_lifted || false,
49
49
  display: result.display || false,
50
50
  automatic_stop: result.automatic_stop_reach_target || false,
51
- automatic_stop_configured: ((_b = result.configuration) === null || _b === void 0 ? void 0 : _b.automatic_stop) || false,
52
- auto_target_humidity: ((_c = result.configuration) === null || _c === void 0 ? void 0 : _c.auto_target_humidity) || 0,
51
+ automatic_stop_configured: ((_c = result.configuration) === null || _c === void 0 ? void 0 : _c.automatic_stop) || false,
52
+ auto_target_humidity: ((_d = result.configuration) === null || _d === void 0 ? void 0 : _d.auto_target_humidity) || 0,
53
53
  configuration: result.configuration || {},
54
54
  connection_status: result.connection_status || null,
55
55
  night_light_brightness: result.night_light_brightness || 0
@@ -132,6 +132,21 @@ class VeSyncHumid200300S extends humidifier_1.VeSyncHumidifier {
132
132
  get nightLightBrightness() {
133
133
  return this.details.night_light_brightness || 0;
134
134
  }
135
+ /**
136
+ * Return JSON details for humidifier
137
+ * Override to include current humidity and target humidity
138
+ */
139
+ displayJSON() {
140
+ var _a, _b, _c;
141
+ const baseInfo = JSON.parse(super.displayJSON());
142
+ // Add current humidity from details
143
+ baseInfo['Humidity'] = ((_a = this.details.humidity) === null || _a === void 0 ? void 0 : _a.toString()) || '0';
144
+ // Add target humidity from configuration
145
+ baseInfo['Target Humidity'] = ((_b = this.details.auto_target_humidity) === null || _b === void 0 ? void 0 : _b.toString()) || '0';
146
+ // Add mist virtual level
147
+ baseInfo['Mist Virtual Level'] = ((_c = this.details.mist_virtual_level) === null || _c === void 0 ? void 0 : _c.toString()) || '0';
148
+ return JSON.stringify(baseInfo, null, 4);
149
+ }
135
150
  /**
136
151
  * Set night light brightness
137
152
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsvesync",
3
- "version": "1.0.68",
3
+ "version": "1.0.69",
4
4
  "description": "A TypeScript library for interacting with VeSync smart home devices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -48,7 +48,7 @@ export class VeSyncHumid200300S extends VeSyncHumidifier {
48
48
  this.details = {
49
49
  mode: result.mode || '',
50
50
  humidity: result.humidity || 0, // Current humidity
51
- target_humidity: result.target_humidity || result.humidity || 0, // Target humidity
51
+ target_humidity: result.configuration?.auto_target_humidity || result.target_humidity || 0, // Target humidity from configuration
52
52
  mist_level: result.mist_level || 0,
53
53
  mist_virtual_level: result.mist_virtual_level || 0,
54
54
  water_lacks: result.water_lacks || false,
@@ -154,6 +154,25 @@ export class VeSyncHumid200300S extends VeSyncHumidifier {
154
154
  return this.details.night_light_brightness || 0;
155
155
  }
156
156
 
157
+ /**
158
+ * Return JSON details for humidifier
159
+ * Override to include current humidity and target humidity
160
+ */
161
+ displayJSON(): string {
162
+ const baseInfo = JSON.parse(super.displayJSON());
163
+
164
+ // Add current humidity from details
165
+ baseInfo['Humidity'] = this.details.humidity?.toString() || '0';
166
+
167
+ // Add target humidity from configuration
168
+ baseInfo['Target Humidity'] = this.details.auto_target_humidity?.toString() || '0';
169
+
170
+ // Add mist virtual level
171
+ baseInfo['Mist Virtual Level'] = this.details.mist_virtual_level?.toString() || '0';
172
+
173
+ return JSON.stringify(baseInfo, null, 4);
174
+ }
175
+
157
176
  /**
158
177
  * Set night light brightness
159
178
  */