Skip to content

Commit

Permalink
Release 3.9.10
Browse files Browse the repository at this point in the history
  • Loading branch information
jghaanstra committed May 30, 2022
1 parent 348c414 commit 24e8ede
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .homeychangelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -466,5 +466,8 @@
},
"3.9.9": {
"en": "This release fixes handling inputs on multichannel devices on Homey Cloud. It also fixes various capabilities being out of range on both Homey Pro and Homey Cloud. A there is some better error handling when connecting to Shelly Cloud for Homey Cloud."
},
"3.9.10": {
"en": "Small bugfixes causing some devices to appear as offline after the latest release."
}
}
2 changes: 1 addition & 1 deletion .homeycompose/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"Shelly radiator"
]
},
"version": "3.9.9",
"version": "3.9.10",
"compatibility": ">=5.0.0",
"platforms": [ "local", "cloud" ],
"author": {
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"Shelly radiator"
]
},
"version": "3.9.9",
"version": "3.9.10",
"compatibility": ">=5.0.0",
"platforms": [
"local",
Expand Down
30 changes: 20 additions & 10 deletions drivers/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ class ShellyDevice extends Homey.Device {
/* updating capabilities */
async updateCapabilityValue(capability, value, channel = 0) {
try {
if (channel === 0) {
if (Number(channel) === 0) {
if (this.hasCapability(capability)) {
if (value != this.getCapabilityValue(capability)) {
if (value !== this.getCapabilityValue(capability) && value !== null) {
this.setCapabilityValue(capability, value);
}
} else {
Expand All @@ -353,7 +353,13 @@ class ShellyDevice extends Homey.Device {
} else {
const device_id = this.getStoreValue('main_device') + '-channel-' + channel;
const device = this.driver.getDevice({id: device_id });
device.updateCapabilityValue(capability, value);
if (device.hasCapability(capability)) {
if (value !== device.getCapabilityValue(capability) && value !== null) {
device.setCapabilityValue(capability, value);
}
} else {
device.addCapability(capability);
}
}
} catch (error) {
this.error('Trying to update capability', capability, 'with value', value, 'for device', this.getData().id);
Expand Down Expand Up @@ -926,13 +932,17 @@ class ShellyDevice extends Homey.Device {
// firmware update available?
if (result.hasOwnProperty("update")) {

const regex = /(?<=\/v)(.*?)(?=\-)/gm;
const version_data = regex.exec(result.update.old_version);
const fw_version = version_data[0];
if (this.getStoreValue('fw_version') === null) {
this.setStoreValue('fw_version', fw_version);
} else if (semver.gt(fw_version, this.getStoreValue('fw_version'))) {
this.setStoreValue('fw_version', fw_version);
if (result.update.hasOwnProperty("old_version")) {
const regex = /(?<=\/v)(.*?)(?=\-)/gm;
const version_data = regex.exec(result.update.old_version);
if (version_data !== null) {
const fw_version = version_data[0];
if (this.getStoreValue('fw_version') === null) {
this.setStoreValue('fw_version', fw_version);
} else if (semver.gt(fw_version, this.getStoreValue('fw_version'))) {
this.setStoreValue('fw_version', fw_version);
}
}
}

if (result.update.has_update === true && (this.getStoreValue('latest_firmware') !== result.update.new_version)) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloud.shelly",
"version": "3.9.9",
"version": "3.9.10",
"description": "Homey app for controlling Shelly devices",
"main": "app.js",
"scripts": {
Expand Down

0 comments on commit 24e8ede

Please sign in to comment.