I just signed up on Github (username: JPLalv), but I didn’t know how to formulate a PR for Gladys.
But never mind, in atrovato [Fix & clean NaN device state], I found this:
// Case for Button devices
case 'click': {
switch (value) {
case 'single':
result = BUTTON_STATUS.CLICK;
break;
case 'double':
result = BUTTON_STATUS.DOUBLE_CLICK;
break;
case 'hold':
result = BUTTON_STATUS.LONG_CLICK;
break;
default:
result = value;
}
break;
The Sonoff SNZH-01 button sends « single », « double » and « long ».
The module above uses « single », « double » and « hold ».
Does this explain it?
What I would do: keep the processing of « hold », since apparently some buttons send this code, and add the processing of « long » with the same result.
I don’t know JavaScript, but I would add something like:
case ‹ long ›:
result = BUTTON_STATUS.LONG_CLICK;
Am I right
?
JPL