mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-28 05:24:29 +00:00
Perfy is nice but we dont need it :(. #2
This commit is contained in:
Generated
-5
@@ -601,11 +601,6 @@
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||
},
|
||||
"perfy": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/perfy/-/perfy-1.1.2.tgz",
|
||||
"integrity": "sha1-5KASR7xab8mfPfHaD9Oi0lU7QyM="
|
||||
},
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
"homepage": "https://github.com/AndrewLinden/xiaomi-zb2mqtt#readme",
|
||||
"dependencies": {
|
||||
"mqtt": "*",
|
||||
"perfy": "*",
|
||||
"zigbee-shepherd": "*",
|
||||
"yaml-config": "*"
|
||||
}
|
||||
|
||||
+7
-11
@@ -1,5 +1,3 @@
|
||||
const perfy = require('perfy');
|
||||
|
||||
const clickLookup = {
|
||||
2: 'double',
|
||||
3: 'triple',
|
||||
@@ -28,16 +26,14 @@ const parsers = [
|
||||
|
||||
// 0 = click down, 1 = click up, else = multiple clicks
|
||||
if (state === 0) {
|
||||
perfy.start(deviceID);
|
||||
setTimeout(() => {
|
||||
if (perfy.exists(deviceID)) {
|
||||
publish('long');
|
||||
perfy.end(deviceID);
|
||||
}
|
||||
}, 300); // After 300 seconds of not releasing we assume long click.
|
||||
store[deviceID] = setTimeout(() => {
|
||||
publish('long');
|
||||
store[deviceID] = null;
|
||||
}, 300); // After 300 milliseconds of not releasing we assume long click.
|
||||
} else if (state === 1) {
|
||||
if (perfy.exists(deviceID)) {
|
||||
perfy.end(deviceID);
|
||||
if (store[deviceID]) {
|
||||
clearTimeout(store[deviceID]);
|
||||
store[deviceID] = null;
|
||||
publish('single');
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user