diff --git a/philipshue/integrationpluginphilipshue.cpp b/philipshue/integrationpluginphilipshue.cpp index 36b7680e..5a9f3bf5 100644 --- a/philipshue/integrationpluginphilipshue.cpp +++ b/philipshue/integrationpluginphilipshue.cpp @@ -1002,12 +1002,16 @@ void IntegrationPluginPhilipsHue::remoteStateChanged() qCWarning(dcPhilipsHue) << "Could not find thing for remote" << remote->name(); return; } - if (thing->thingClassId() == tapThingClassId) { - thing->setStateValue(tapConnectedStateTypeId, remote->reachable()); - } else { + if (thing->thingClassId() == remoteThingClassId) { thing->setStateValue(remoteConnectedStateTypeId, remote->reachable()); thing->setStateValue(remoteBatteryLevelStateTypeId, remote->battery()); thing->setStateValue(remoteBatteryCriticalStateTypeId, remote->battery() < 5); + } else if (thing->thingClassId() == tapThingClassId) { + thing->setStateValue(tapConnectedStateTypeId, remote->reachable()); + } else if (thing->thingClassId() == smartButtonThingClassId) { + thing->setStateValue(smartButtonConnectedStateTypeId, remote->reachable()); + thing->setStateValue(smartButtonBatteryLevelStateTypeId, remote->battery()); + thing->setStateValue(smartButtonBatteryCriticalStateTypeId, remote->battery() < 5); } } diff --git a/philipshue/integrationpluginphilipshue.json b/philipshue/integrationpluginphilipshue.json index 112d72bb..69779f56 100644 --- a/philipshue/integrationpluginphilipshue.json +++ b/philipshue/integrationpluginphilipshue.json @@ -567,6 +567,25 @@ "defaultValue": false, "type": "bool", "cached": false + }, + { + "id": "a0a1b480-6822-49bc-b1b1-50c39764d255", + "name": "batteryLevel", + "displayName": "Battery level", + "displayNameEvent": "Battery level changed", + "type": "int", + "unit": "Percentage", + "defaultValue": 0, + "minValue": 0, + "maxValue": 100 + }, + { + "id": "7c1fd7c1-f322-4be7-9c22-7d14d0ec38ea", + "name": "batteryCritical", + "displayName": "Battery critical", + "displayNameEvent": "Battery critical changed", + "type": "bool", + "defaultValue": false } ], "eventTypes": [