Skip to content

Commit

Permalink
is_on condition card for devices
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen van Reenen authored and Jeroen van Reenen committed Sep 23, 2017
1 parent add00c1 commit 6191b0c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
21 changes: 20 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions drivers/harmony_device_driver/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -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..`);
}

Expand Down

0 comments on commit 6191b0c

Please sign in to comment.