diff --git a/app.json b/app.json index 2784a2d..f251dd4 100644 --- a/app.json +++ b/app.json @@ -9,7 +9,10 @@ "en": "Adds support for logitech's Harmony Hub", "nl": "Voegt functies toe van de logitech's Harmony Hub" }, - "category": ["appliances", "video"], + "category": [ + "appliances", + "video" + ], "version": "1.2.0", "compatibility": ">=1.5.0", "images": { @@ -189,6 +192,22 @@ ] } ], + "conditions": [ + { + "id": "is_on", + "title": { + "en": "Device !{{is|isn't}} on", + "nl": "Appraat !{{is|is niet}} aan" + }, + "args": [ + { + "name": "hub_device", + "type": "device", + "filter": "driver_id=harmony_device_driver" + } + ] + } + ], "actions": [ { "id": "start_activity", diff --git a/drivers/harmony_device_driver/device.js b/drivers/harmony_device_driver/device.js index 7c3b64e..7bf4e33 100644 --- a/drivers/harmony_device_driver/device.js +++ b/drivers/harmony_device_driver/device.js @@ -21,6 +21,15 @@ class HarmonyDevice extends Homey.Device { }); }); + let isOnCondition = new Homey.FlowCardCondition('is_on'); + isOnCondition + .register() + .registerRunListener((args, state) => { + let isPowerdOn = args.hub_device.device.power === 'On'; + console.log(`Condition ${isPowerdOn}`); + return Promise.resolve(isPowerdOn); + }); + console.log(`Device (${this._deviceData.id}) - ${this._deviceData.name} initializing..`); }