sinricpro 2.10.1 → 2.11.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/CHANGELOG.md CHANGED
@@ -8,4 +8,27 @@
8
8
  ## [2.7.1]
9
9
 
10
10
  ### Features
11
- * **Push notification feature added**
11
+ * **Push notification feature added**
12
+
13
+ ## [2.8.1]
14
+ * feat: Camera support.
15
+
16
+ ## [2.9.1]
17
+
18
+ ### Features
19
+ * fix: setThermostatMode
20
+
21
+ ## [2.10.1]
22
+
23
+ ### Features
24
+ * fix: adjustTargetTemperature
25
+
26
+ ## [2.11.1]
27
+
28
+ ### Features
29
+ * fix: targetTemperature
30
+
31
+ ## [2.11.2]
32
+
33
+ ### Features
34
+ * fix: adjustTargetTemperature response format.
package/lib/cbhandler.js CHANGED
@@ -170,7 +170,7 @@ const handlePayload = (client, payload, signature, callbacks) => verifySignature
170
170
  return AdjustTargetTemperature(payload, callbacks)
171
171
  .then((resp) => {
172
172
  const { temperature } = resp;
173
- return jsonResponse(client, payload, temperature);
173
+ return jsonResponse(client, payload, { temperature });
174
174
  })
175
175
  .catch(handleError);
176
176
  }
@@ -55,19 +55,9 @@ const eventNames = {
55
55
  mute: "setMute",
56
56
  currentTemperature: "currentTemperature",
57
57
  pushNotification: "pushNotification",
58
+ targetTemperature: "targetTemperature"
58
59
  };
59
-
60
- const actionArr = [
61
- "setPowerState",
62
- "setBrightness",
63
- "setPowerLevel",
64
- "setColor",
65
- "setColorTemperature",
66
- "DoorbellPress",
67
- "currentTemperature",
68
- "pushNotification",
69
- "setThermostatMode",
70
- ];
60
+
71
61
 
72
62
  const getJson = (client, eventName, deviceId, value) => {
73
63
  const header = {
@@ -93,11 +83,11 @@ const getJson = (client, eventName, deviceId, value) => {
93
83
  };
94
84
 
95
85
  const raiseEvent = async (client, eventName, deviceId, value) => {
96
- if (actionArr.includes(eventName)) {
86
+ if (Object.hasOwn(eventNames, eventName)) {
97
87
  try {
98
88
  await burstyLimiter.consume("queue");
99
89
  const request = JSON.stringify(getJson(client, eventName, deviceId, value));
100
- if (process.env.SR_DEBUG) console.log(">> %j", request);
90
+ if (process.env.SR_DEBUG) console.log(">> %s", request);
101
91
  client.send(request);
102
92
  } catch (rlRejected) {
103
93
  console.log("Too many events!");
package/lib/sinrcpro.js CHANGED
@@ -15,7 +15,7 @@ const sdkVersion = require('./../package.json').version;
15
15
 
16
16
  class SinricPro extends Websocket {
17
17
  constructor(appkey, deviceids, secretKey, restoreStates) {
18
- super("wss://ws.sinric.pro", {
18
+ super("wss://testws.sinric.pro", {
19
19
  headers: {
20
20
  appkey,
21
21
  deviceids: deviceids.join(';'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinricpro",
3
- "version": "2.10.1",
3
+ "version": "2.11.2",
4
4
  "description": "Sinric Pro Nodejs SDK",
5
5
  "main": "index.js",
6
6
  "repository": {