try to work around polling madness

master
Michael Zanetti 2020-04-01 15:48:01 +02:00
parent ab61e93eae
commit 0393ad9010
1 changed files with 42 additions and 32 deletions

View File

@ -1029,38 +1029,46 @@ void IntegrationPluginPhilipsHue::onRemoteButtonEvent(int buttonCode)
if (thing->thingClassId() == remoteThingClassId) {
switch (buttonCode) {
case 1002:
param = Param(remotePressedEventButtonNameParamTypeId, "ON");
id = remotePressedEventTypeId;
break;
case 1001:
param = Param(remoteLongPressedEventButtonNameParamTypeId, "ON");
id = remoteLongPressedEventTypeId;
break;
case 2002:
param = Param(remotePressedEventButtonNameParamTypeId, "DIM UP");
id = remotePressedEventTypeId;
break;
case 2001:
param = Param(remoteLongPressedEventButtonNameParamTypeId, "DIM UP");
id = remoteLongPressedEventTypeId;
break;
case 3002:
param = Param(remotePressedEventButtonNameParamTypeId, "DIM DOWN");
id = remotePressedEventTypeId;
break;
case 3001:
param = Param(remoteLongPressedEventButtonNameParamTypeId, "DIM DOWN");
id = remoteLongPressedEventTypeId;
break;
case 4002:
param = Param(remotePressedEventButtonNameParamTypeId, "OFF");
id = remotePressedEventTypeId;
break;
case 4001:
param = Param(remoteLongPressedEventButtonNameParamTypeId, "OFF");
id = remoteLongPressedEventTypeId;
break;
case 1000:
case 1002:
param = Param(remotePressedEventButtonNameParamTypeId, "ON");
id = remotePressedEventTypeId;
break;
case 1001:
case 1003:
param = Param(remoteLongPressedEventButtonNameParamTypeId, "ON");
id = remoteLongPressedEventTypeId;
break;
case 2000:
case 2002:
param = Param(remotePressedEventButtonNameParamTypeId, "DIM UP");
id = remotePressedEventTypeId;
break;
case 2001:
case 2003:
param = Param(remoteLongPressedEventButtonNameParamTypeId, "DIM UP");
id = remoteLongPressedEventTypeId;
break;
case 3000:
case 3002:
param = Param(remotePressedEventButtonNameParamTypeId, "DIM DOWN");
id = remotePressedEventTypeId;
break;
case 3001:
case 3003:
param = Param(remoteLongPressedEventButtonNameParamTypeId, "DIM DOWN");
id = remoteLongPressedEventTypeId;
break;
case 4000:
case 4002:
param = Param(remotePressedEventButtonNameParamTypeId, "OFF");
id = remotePressedEventTypeId;
break;
case 4001:
case 4003:
param = Param(remoteLongPressedEventButtonNameParamTypeId, "OFF");
id = remoteLongPressedEventTypeId;
break;
default:
qCDebug(dcPhilipsHue()) << "Unhandled button code received from Hue Remoote:" << buttonCode;
return;
@ -1090,8 +1098,10 @@ void IntegrationPluginPhilipsHue::onRemoteButtonEvent(int buttonCode)
} else if (thing->thingClassId() == smartButtonThingClassId) {
switch (buttonCode) {
case 1000:
case 1002:
id = smartButtonPressedEventTypeId;
break;
case 1001:
case 1003:
id = smartButtonLongPressedEventTypeId;
break;