diff --git a/.homeychangelog.json b/.homeychangelog.json index a7bd1d01..b46ca274 100644 --- a/.homeychangelog.json +++ b/.homeychangelog.json @@ -100,5 +100,8 @@ }, "1.22.3": { "en": "Add support for Shelly Dimmer 2" + }, + "1.23.0": { + "en": "Added device ID to callback trigger card and removed the old button events card which was deprecated since the last couple of app versions." } } diff --git a/api.js b/api.js index 72621c2e..cb5baedd 100644 --- a/api.js +++ b/api.js @@ -25,11 +25,8 @@ module.exports = [ device.setCapabilityValue('alarm_water', false); } - // TODO: DEPRECATED, WILL BE REMOVED IN NEXT MAJOR RELEASE - device.triggerCallbackEvents(args.params.action); - let callbackTrigger = new Homey.FlowCardTrigger('triggerCallbacks'); - callbackTrigger.register().trigger({"device": device.getName(), "action": args.params.action}); + callbackTrigger.register().trigger({"id": args.params.deviceid, "device": device.getName(), "action": args.params.action}); callback(false, 'OK'); })().catch(err => { @@ -44,7 +41,7 @@ module.exports = [ public : true, fn: function(args, callback) { (async () => { - console.log(args); + console.log(args); // leave this in for sending debug reports let device = await Homey.ManagerDrivers.getDriver(args.params.devicetype).getDevice({'id': args.params.deviceid}); await device.updateReportStatus(device, args.query); callback(false, 'OK'); diff --git a/app.json b/app.json index 4cabb9cd..d4f1dbb4 100644 --- a/app.json +++ b/app.json @@ -46,7 +46,7 @@ "Shelly i3" ] }, - "version": "1.22.3", + "version": "1.23.0", "compatibility": ">=3.0.0", "author": { "name": "Jelger Haanstra", @@ -3776,48 +3776,27 @@ ] }, { - "id": "triggerCallbackEvents", - "deprecated": true, + "id": "triggerCallbacks", "title": { "en": "Action event", "nl": "Actie gebeurtenis" }, "tokens": [ { - "name": "action", + "name": "id", "type": "string", "title": { - "en": "Action", - "nl": "Actie" - }, - "example": "longpush" - } - ], - "args": [ - { - "name": "device", - "type": "device", - "placeholder": { - "en": "Select Shelly", - "nl": "Selecteer Shelly" + "en": "Device ID", + "nl": "Apparaat ID" }, - "filter": "driver_id=shelly1|shelly1pm|shellydimmer|shelly2|shelly25|shelly-plug|shelly-plug-s|shellyem|shelly3em|shellydw|shellyduo|shellyflood|shellyi3&capabilities=button.callbackevents" - } - ] - }, - { - "id": "triggerCallbacks", - "title": { - "en": "Action event", - "nl": "Actie gebeurtenis" - }, - "tokens": [ + "example": "shelly1-8D4C25" + }, { "name": "device", "type": "string", "title": { - "en": "Device", - "nl": "Apparaat" + "en": "Name", + "nl": "Naam" }, "example": "Shelly 1" }, diff --git a/drivers/shelly-plug-s/device.js b/drivers/shelly-plug-s/device.js index d768f47c..eb2f7d8b 100644 --- a/drivers/shelly-plug-s/device.js +++ b/drivers/shelly-plug-s/device.js @@ -6,8 +6,6 @@ const util = require('/lib/util.js'); class ShellyPlugSDevice extends Homey.Device { onInit() { - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); - this.pollDevice(); this.setAvailable(); @@ -145,10 +143,6 @@ class ShellyPlugSDevice extends Homey.Device { }, 63000); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = ShellyPlugSDevice; diff --git a/drivers/shelly-plug/device.js b/drivers/shelly-plug/device.js index d261fa20..0f29daa2 100644 --- a/drivers/shelly-plug/device.js +++ b/drivers/shelly-plug/device.js @@ -6,8 +6,6 @@ const util = require('/lib/util.js'); class ShellyPlugDevice extends Homey.Device { onInit() { - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); - this.pollDevice(); this.setAvailable(); @@ -137,10 +135,6 @@ class ShellyPlugDevice extends Homey.Device { }, 63000); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = ShellyPlugDevice; diff --git a/drivers/shelly1/device.js b/drivers/shelly1/device.js index a1a6b742..d25adbf3 100644 --- a/drivers/shelly1/device.js +++ b/drivers/shelly1/device.js @@ -8,7 +8,6 @@ class Shelly1Device extends Homey.Device { onInit() { new Homey.FlowCardTriggerDevice('triggerShelly1Temperature2').register(); new Homey.FlowCardTriggerDevice('triggerShelly1Temperature3').register(); - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); this.pollDevice(); this.setAvailable(); @@ -166,10 +165,6 @@ class Shelly1Device extends Homey.Device { }, 63000); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}); - } - } module.exports = Shelly1Device; diff --git a/drivers/shelly1/driver.js b/drivers/shelly1/driver.js index 28bbf125..d2bcf531 100644 --- a/drivers/shelly1/driver.js +++ b/drivers/shelly1/driver.js @@ -12,7 +12,6 @@ class Shelly1Driver extends Homey.Driver { let deviceArray = {}; socket.on('list_devices', (data, callback) => { - this.log(discoveryResults); const devices = Object.values(discoveryResults).map(discoveryResult => { return { name: 'Shelly1 ['+ discoveryResult.address +']', diff --git a/drivers/shelly1pm/device.js b/drivers/shelly1pm/device.js index d7a09db1..e2c4f24e 100644 --- a/drivers/shelly1pm/device.js +++ b/drivers/shelly1pm/device.js @@ -9,7 +9,6 @@ class Shelly1pmDevice extends Homey.Device { new Homey.FlowCardTriggerDevice('triggerShelly1Temperature1').register(); new Homey.FlowCardTriggerDevice('triggerShelly1Temperature2').register(); new Homey.FlowCardTriggerDevice('triggerShelly1Temperature3').register(); - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); this.pollDevice(); this.setAvailable(); @@ -197,10 +196,6 @@ class Shelly1pmDevice extends Homey.Device { }, 63000); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = Shelly1pmDevice; diff --git a/drivers/shelly2/device.js b/drivers/shelly2/device.js index efbf1e7b..91adb526 100644 --- a/drivers/shelly2/device.js +++ b/drivers/shelly2/device.js @@ -6,8 +6,6 @@ const util = require('/lib/util.js'); class Shelly2Device extends Homey.Device { onInit() { - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); - this.setAvailable(); // ADD MISSING CAPABILITIES @@ -78,10 +76,6 @@ class Shelly2Device extends Homey.Device { return Homey.ManagerDrivers.getDriver('shelly2').loadDevices(); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = Shelly2Device; diff --git a/drivers/shelly25/device.js b/drivers/shelly25/device.js index 571115a2..cb5589fd 100644 --- a/drivers/shelly25/device.js +++ b/drivers/shelly25/device.js @@ -8,7 +8,6 @@ class Shelly25Device extends Homey.Device { onInit() { new Homey.FlowCardTriggerDevice('triggerMeterPowerFactor').register(); new Homey.FlowCardTriggerDevice('triggerMeterPowerWmin').register(); - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); this.setAvailable(); @@ -80,10 +79,6 @@ class Shelly25Device extends Homey.Device { return Homey.ManagerDrivers.getDriver('shelly25').loadDevices(); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = Shelly25Device; diff --git a/drivers/shelly3em/device.js b/drivers/shelly3em/device.js index fba623fb..dc6057e2 100644 --- a/drivers/shelly3em/device.js +++ b/drivers/shelly3em/device.js @@ -9,7 +9,6 @@ class Shelly3EmDevice extends Homey.Device { new Homey.FlowCardTriggerDevice('triggerMeterPowerConsumed').register(); new Homey.FlowCardTriggerDevice('triggerMeterPowerReturned').register(); new Homey.FlowCardTriggerDevice('triggerMeterPowerFactor').register(); - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); this.setAvailable(); @@ -65,10 +64,6 @@ class Shelly3EmDevice extends Homey.Device { return Homey.ManagerDrivers.getDriver('shelly3em').loadDevices(); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = Shelly3EmDevice; diff --git a/drivers/shellydimmer/device.js b/drivers/shellydimmer/device.js index 9fceb156..5be5316b 100644 --- a/drivers/shellydimmer/device.js +++ b/drivers/shellydimmer/device.js @@ -8,7 +8,6 @@ class ShellyDimmerDevice extends Homey.Device { onInit() { new Homey.FlowCardTriggerDevice('triggerDimmerInput1').register(); new Homey.FlowCardTriggerDevice('triggerDimmerInput2').register(); - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); this.pollDevice(); this.setAvailable(); @@ -213,10 +212,6 @@ class ShellyDimmerDevice extends Homey.Device { }, 63000); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = ShellyDimmerDevice; diff --git a/drivers/shellyduo/device.js b/drivers/shellyduo/device.js index 917100a3..3d11e9f5 100644 --- a/drivers/shellyduo/device.js +++ b/drivers/shellyduo/device.js @@ -6,8 +6,6 @@ const util = require('/lib/util.js'); class ShellyDuoDevice extends Homey.Device { onInit() { - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); - this.pollDevice(); this.setAvailable(); @@ -144,10 +142,6 @@ class ShellyDuoDevice extends Homey.Device { }, 63000); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = ShellyDuoDevice; diff --git a/drivers/shellydw/device.js b/drivers/shellydw/device.js index 03340693..90ed6d21 100644 --- a/drivers/shellydw/device.js +++ b/drivers/shellydw/device.js @@ -6,8 +6,6 @@ const util = require('/lib/util.js'); class ShellydwDevice extends Homey.Device { onInit() { - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); - this.pollDevice(); this.setAvailable(); @@ -106,10 +104,6 @@ class ShellydwDevice extends Homey.Device { }, 4000); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = ShellydwDevice; diff --git a/drivers/shellyem/device.js b/drivers/shellyem/device.js index 9b791827..6a978095 100644 --- a/drivers/shellyem/device.js +++ b/drivers/shellyem/device.js @@ -9,7 +9,6 @@ class ShellyEmDevice extends Homey.Device { new Homey.FlowCardTriggerDevice('triggerMeterPowerConsumed').register(); new Homey.FlowCardTriggerDevice('triggerMeterPowerReturned').register(); new Homey.FlowCardTriggerDevice('triggerReactivePower').register(); - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); this.setAvailable(); @@ -65,10 +64,6 @@ class ShellyEmDevice extends Homey.Device { return Homey.ManagerDrivers.getDriver('shellyem').loadDevices(); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = ShellyEmDevice; diff --git a/drivers/shellyflood/device.js b/drivers/shellyflood/device.js index 89121008..dca81234 100644 --- a/drivers/shellyflood/device.js +++ b/drivers/shellyflood/device.js @@ -6,8 +6,6 @@ const util = require('/lib/util.js'); class ShellyFloodDevice extends Homey.Device { onInit() { - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); - this.setAvailable(); // ADD MISSING CAPABILITIES @@ -67,10 +65,6 @@ class ShellyFloodDevice extends Homey.Device { } // HELPER FUNCTIONS - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - updateReportStatus(device, status) { var alarm = Number(status.flood) == 0 ? false : true; diff --git a/drivers/shellyi3/device.js b/drivers/shellyi3/device.js index 283e004f..17b04f34 100644 --- a/drivers/shellyi3/device.js +++ b/drivers/shellyi3/device.js @@ -6,8 +6,6 @@ const util = require('/lib/util.js'); class Shellyi3Device extends Homey.Device { onInit() { - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); - this.registerCapabilityListener('button.callbackevents', async () => { this.addCallbackUrls(); }); @@ -169,10 +167,6 @@ class Shellyi3Device extends Homey.Device { } } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = Shellyi3Device; diff --git a/drivers/shellyrgbw2white/device.js b/drivers/shellyrgbw2white/device.js index fca6c689..8011f364 100644 --- a/drivers/shellyrgbw2white/device.js +++ b/drivers/shellyrgbw2white/device.js @@ -6,7 +6,6 @@ const util = require('/lib/util.js'); class ShellyRGBW2WhiteDevice extends Homey.Device { onInit() { - this.setAvailable(); // LISTENERS FOR UPDATING CAPABILITIES diff --git a/drivers/shellyvintage/device.js b/drivers/shellyvintage/device.js index bca0a3b8..2c1ebcc8 100644 --- a/drivers/shellyvintage/device.js +++ b/drivers/shellyvintage/device.js @@ -6,8 +6,6 @@ const util = require('/lib/util.js'); class ShellyVintageDevice extends Homey.Device { onInit() { - new Homey.FlowCardTriggerDevice('triggerCallbackEvents').register(); - this.pollDevice(); this.setAvailable(); @@ -134,10 +132,6 @@ class ShellyVintageDevice extends Homey.Device { }, 63000); } - triggerCallbackEvents(action) { - return Homey.ManagerFlow.getCard('trigger', "triggerCallbackEvents").trigger(this, {"action": action}, {}) - } - } module.exports = ShellyVintageDevice; diff --git a/package-lock.json b/package-lock.json index 85ee6fd3..4a04952d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cloud.shelly", - "version": "1.22.3", + "version": "1.23.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4a90519c..c79364e2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cloud.shelly", - "version": "1.22.3", + "version": "1.23.0", "description": "Homey app for controlling Shelly devices", "main": "app.js", "scripts": {