From 0393ad9010ef5b43fb4aaac5d6a57117c8314dc3 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 1 Apr 2020 15:48:01 +0200 Subject: [PATCH] try to work around polling madness --- philipshue/integrationpluginphilipshue.cpp | 74 ++++++++++++---------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/philipshue/integrationpluginphilipshue.cpp b/philipshue/integrationpluginphilipshue.cpp index 419168c4..c24b3347 100644 --- a/philipshue/integrationpluginphilipshue.cpp +++ b/philipshue/integrationpluginphilipshue.cpp @@ -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;