Fix smartButton connected state and add battery level
This commit is contained in:
parent
35ef42f233
commit
6713ef8a78
@ -1002,12 +1002,16 @@ void IntegrationPluginPhilipsHue::remoteStateChanged()
|
|||||||
qCWarning(dcPhilipsHue) << "Could not find thing for remote" << remote->name();
|
qCWarning(dcPhilipsHue) << "Could not find thing for remote" << remote->name();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (thing->thingClassId() == tapThingClassId) {
|
if (thing->thingClassId() == remoteThingClassId) {
|
||||||
thing->setStateValue(tapConnectedStateTypeId, remote->reachable());
|
|
||||||
} else {
|
|
||||||
thing->setStateValue(remoteConnectedStateTypeId, remote->reachable());
|
thing->setStateValue(remoteConnectedStateTypeId, remote->reachable());
|
||||||
thing->setStateValue(remoteBatteryLevelStateTypeId, remote->battery());
|
thing->setStateValue(remoteBatteryLevelStateTypeId, remote->battery());
|
||||||
thing->setStateValue(remoteBatteryCriticalStateTypeId, remote->battery() < 5);
|
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,
|
"defaultValue": false,
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"cached": false
|
"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": [
|
"eventTypes": [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user