isy-nodejs 1.0.1-alpha.20 → 1.0.1-alpha.22

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
@@ -2,7 +2,7 @@
2
2
  "name": "isy-nodejs",
3
3
  "description": "Node.js wrapper for ISY interface including websockets for change notifications. Fork of isy-js by Rod Toll. Designed to be used in a node.js application.",
4
4
  "license": "MIT",
5
- "version": "1.0.1-alpha.20",
5
+ "version": "1.0.1-alpha.22",
6
6
  "author": {
7
7
  "name": "Pradeep Mouli"
8
8
  },
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "3b8710c1b6a783c32744c2f97f56ba8b836b02ca"
72
+ "gitHead": "58d143722781c7f2388e90af3b69eb112bc190ed"
73
73
  }
package/src/ISY.ts CHANGED
@@ -561,9 +561,16 @@ export class ISY extends EventEmitter implements Disposable {
561
561
  let uriToUse = `nodes/${node.address}/cmd/${command}`;
562
562
  if (parameters !== null && parameters !== undefined) {
563
563
  if (typeof parameters == 'object') {
564
+
564
565
  var q = parameters as Record<P, string | number>;
565
566
  for (const paramName of Object.getOwnPropertyNames(q)) {
566
- uriToUse += `/${paramName}/${q[paramName]}`;
567
+ if(paramName === 'value')
568
+ {
569
+ uriToUse += `/${q[paramName]}`;
570
+ continue;
571
+ }
572
+ if(typeof q[paramName] === 'string' || typeof q[paramName] === 'number')
573
+ uriToUse += `/${paramName}/${q[paramName]}`;
567
574
  }
568
575
 
569
576
  //uriToUse += `/${q[((p : Record<string,number|number>) => `${p[]}/${p.paramValue}` ).join('/')}`;
@@ -58,9 +58,9 @@ export class ISYDimmableBehavior extends ISYClusterBehavior(DimmableLightRequire
58
58
  override setLevel(level: number): MaybePromise<void> {
59
59
  level = Converter.Matter.LevelFrom0To255.LightingLevel.from(level);
60
60
  if (level > 0) {
61
- return this.device.sendCommand('DON', level);
61
+ return this.device.on();
62
62
  } else {
63
- return this.device.sendCommand('DOF');
63
+ return this.device.off();
64
64
  }
65
65
  }
66
66
  }
package/src/Utils.ts CHANGED
@@ -282,13 +282,13 @@ export async function findPackageJson(currentPath: string = getImportMeta().dirn
282
282
  while (currentPath !== '/') {
283
283
  const packageJsonPath = path.join(currentPath, 'package.json');
284
284
  if (existsSync(packageJsonPath)) {
285
- return JSON.parse(await readFile(packageJsonPath, 'utf8'));
285
+ return JSON.parse((await readFile(packageJsonPath)).toString());
286
286
  }
287
287
  currentPath = path.join(currentPath, '..');
288
288
  }
289
289
  } catch {
290
290
  //@ts-expect-error
291
- return (await import('../../package.json')).default;
291
+ return (await import('../../package.json', { with: { type: 'json' } })).default;
292
292
  }
293
293
  return null;
294
294
  }