From f4d667fa1d7a17d38bb42605d76649cc9371de13 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 9 Apr 2022 23:11:15 +0000 Subject: [PATCH 1/2] Bump minimist from 1.2.5 to 1.2.6 Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 22f0185..eecebff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2276,9 +2276,9 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "node_modules/mocha": { @@ -2786,7 +2786,7 @@ }, "node_modules/readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "dependencies": { @@ -5208,9 +5208,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "mocha": { @@ -5589,7 +5589,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { From 1aa443a117e47db71eb9d0b9884dfdc4ab092cb1 Mon Sep 17 00:00:00 2001 From: Thom Ritterfeld Date: Fri, 3 Sep 2021 09:43:37 +0200 Subject: [PATCH 2/2] Support for Shelly1AddOn --- README.md | 1 + lib/devices/shelly-1-addon.js | 55 +++++++++++++++++++++++++++++++++++ lib/devices/shelly-1.js | 3 ++ 3 files changed, 59 insertions(+) create mode 100644 lib/devices/shelly-1-addon.js diff --git a/README.md b/README.md index 2eabdd8..3c53ce0 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ The following Shelly devices are supported: * [Shelly 1](https://shelly.cloud/shelly1-open-source/) * [Shelly 1L](https://shelly.cloud/products/shelly-1l-single-wire-smart-home-automation-relay/) * [Shelly 1PM](https://shelly.cloud/shelly-1pm-wifi-smart-relay-home-automation/) +* [Shelly 1AddOn](https://shop.shelly.cloud/temperature-sensor-addon-for-shelly-1-1pm-wifi-smart-home-automation) * Shelly 2 * [Shelly 2.5](https://shelly.cloud/shelly-25-wifi-smart-relay-roller-shutter-home-automation/) * Shelly 2LED diff --git a/lib/devices/shelly-1-addon.js b/lib/devices/shelly-1-addon.js new file mode 100644 index 0000000..d8ffb74 --- /dev/null +++ b/lib/devices/shelly-1-addon.js @@ -0,0 +1,55 @@ +class Shelly1AddOn { + constructor(device) { + this.device = device + } + + async setExternalSensorTemperatureUnit(fahrenheit) { + await this.device.request + .get(`${this.device.host}/settings`) + .query( + { ext_sensors_temperature_unit: fahrenheit ? 'F' : 'C' } + ) + } + + async setExternalTemperatureAct(index, overAct, underAct) { + await this.device.request + .get(`${this.device.host}/settings/ext_temperature/${index}`) + .query( + { + overtemp_act: overAct, + undertemp_act: underAct + }) + } + + async setExternalTemperatureThreshold(index, overtemp, undertemp) { + await this.device.request + .get(`${this.device.host}/settings/ext_temperature/${index}`) + .query( + { + overtemp_threshold_tC: overtemp, + undertemp_threshold_tC: undertemp + }) + } + + async setExternalHumidityAct(index, overAct, underAct) { + await this.device.request + .get(`${this.device.host}/settings/ext_humidity/${index}`) + .query( + { + overhum_act: overAct, + underhum_act: underAct + }) + } + + async setExternalHumidityThreshold(index, overhum, underhum) { + await this.device.request + .get(`${this.device.host}/settings/ext_humidity/${index}`) + .query( + { + overhum_threshold: overhum, + underhum_threshold: underhum + }) + } +} + +module.exports = Shelly1AddOn diff --git a/lib/devices/shelly-1.js b/lib/devices/shelly-1.js index 39f6634..7850de7 100644 --- a/lib/devices/shelly-1.js +++ b/lib/devices/shelly-1.js @@ -1,4 +1,5 @@ const { Switch } = require('./base') +const Shelly1AddOn = require('./shelly-1-addon') class Shelly1 extends Switch { constructor(id, host) { @@ -17,6 +18,8 @@ class Shelly1 extends Switch { this._defineProperty('externalHumidity', [3103], null, Number) this._defineProperty('externalInput0', [3117], null, Number) + + this.addon = new Shelly1AddOn(this) } }