From ed25091be6c0669c9d4291ab9b8e5571039e7122 Mon Sep 17 00:00:00 2001 From: Agav Date: Mon, 4 Nov 2024 21:07:47 +0300 Subject: [PATCH 1/2] ptvo: Add hold Action --- lib/devices.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/devices.js b/lib/devices.js index 0fc50b8d..30b7d21f 100644 --- a/lib/devices.js +++ b/lib/devices.js @@ -306,7 +306,9 @@ const generator = { setattr: 'state', }); } - if (endpoint.supportsOutputCluster('genMultistateInput')) { + if (endpoint.supportsOutputCluster('genMultistateInput')|| + endpoint.clusters.hasOwnProperty('genMultistateInput') + ) { devstates.push({ id: `channel_${epID}.click`, prop: 'action', @@ -343,6 +345,18 @@ const generator = { isEvent: true, getter: payload => payload.action === `tripple_${epName}` ? true : undefined, }); + devstates.push({ + id: `channel_${epID}.hold`, + prop: 'action', + name: `long click event`, + icon: undefined, + role: 'button', + write: false, + read: true, + type: 'boolean', + isEvent: true, + getter: payload => payload.action === `hold_${epName}` ? true : undefined, + }); } if (endpoint.supportsOutputCluster('genLevelCtrl')) { devstates.push({ From 96458a5c02feaca4f80143886c97ba87e277ee57 Mon Sep 17 00:00:00 2001 From: Agav Date: Fri, 15 Nov 2024 19:58:44 +0300 Subject: [PATCH 2/2] commented the unused PTVO code --- lib/devices.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/devices.js b/lib/devices.js index 30b7d21f..1c7d4cf5 100644 --- a/lib/devices.js +++ b/lib/devices.js @@ -501,7 +501,7 @@ const generator = { }); return icasa_states; }, - ptvo_switch: (entity) => { + /*ptvo_switch: (entity) => { const devstates = []; for (const endpoint of entity.device.endpoints) { const epID = endpoint.ID; @@ -580,7 +580,7 @@ const generator = { } } return devstates; - }, + },*/ }; function states_with_epname(entity, states) {