Fix smartButton connected state and add battery level
parent
35ef42f233
commit
6713ef8a78
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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": [
|
||||
|
|
|
|||
Loading…
Reference in New Issue