Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,21 @@
}
]
}
],
"conditions": [
{
"id": "samsung_washer_job_running",
"title": {
"en": "Samsung Washer !{{is|isn't}} running"
},
"args": [
{
"type": "device",
"name": "device",
"filter": "driver_id=washer"
}
]
}
]
},
"drivers": [
Expand Down
8 changes: 8 additions & 0 deletions drivers/washer/driver.flow.compose.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,13 @@
"capabilities": "alarm_samsung_washer_addwash_door_open"
}
}
],
"conditions": [
{
"id": "samsung_washer_job_running",
"title": {
"en": "Samsung Washer !{{is|isn't}} running"
}
}
]
}
16 changes: 16 additions & 0 deletions drivers/washer/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ const SmartThingsDriver = require('../../lib/SmartThingsDriver');

module.exports = class SmartThingsDriverWasher extends SmartThingsDriver {

async onOAuth2Init() {
await super.onOAuth2Init();

// Register condition card for checking if washer is running
this.homey.flow
.getConditionCard('samsung_washer_job_running')
.registerRunListener(async ({ device }) => {
// Get the current job state from the device
const currentJobState = device.getCapabilityValue('samsung_washer_current_job_state');

// Return true if washer is running (not in idle/finished/none state)
const idleStates = ['finished', 'idle', 'none', null, undefined];
return currentJobState && !idleStates.includes(currentJobState);
});
}

onPairFilterDevice(device) {
this.log('onPairFilterDevice', device.deviceTypeName);

Expand Down