Only handle things as disconnected when they implement the connectable interface

This commit is contained in:
Michael Zanetti 2023-11-03 23:05:08 +01:00
parent d12ac8eacd
commit 92e001b332
4 changed files with 4 additions and 3 deletions

View File

@ -8,7 +8,7 @@ BigTile {
property Thing thing: null
readonly property State connectedState: thing.stateByName("connected")
readonly property State connectedState: thing.thingClass.interfaces.indexOf("connectable") >= 0 && thing.stateByName("connected")
readonly property bool isConnected: connectedState === null || connectedState.value === true
readonly property bool isEnabled: thing.setupStatus == Thing.ThingSetupStatusComplete && isConnected

View File

@ -13,7 +13,7 @@ InfoPaneBase {
readonly property bool setupFailure: root.thing.setupStatus == Thing.ThingSetupStatusFailed
readonly property State batteryState: root.thing.stateByName("batteryLevel")
readonly property State batteryCriticalState: root.thing.stateByName("batteryCritical")
readonly property State connectedState: root.thing.stateByName("connected")
readonly property State connectedState: root.thing.thingClass.interfaces.indexOf("connectable") >= 0 && root.thing.stateByName("connected")
readonly property State signalStrengthState: root.thing.stateByName("signalStrength")
readonly property State updateStatusState: root.thing.stateByName("updateStatus")
readonly property State childLockState: root.thing.stateByName("childLock")

View File

@ -89,7 +89,7 @@ RowLayout {
Layout.preferredHeight: Style.smallIconSize
Layout.preferredWidth: height
thing: root.thing
visible: root.thing.setupStatus == Thing.ThingSetupStatusComplete && (hasSignalStrength || !isConnected)
visible: root.thing.setupStatus == Thing.ThingSetupStatusComplete && root.thing.thingClass.interfaces.indexOf("connectable") >= 0 && (hasSignalStrength || !isConnected)
Binding { target: connectionStatusIcon; property: "color"; value: root.color; when: root.color !== Style.iconColor }
MouseArea {
anchors.fill: parent

View File

@ -130,6 +130,7 @@ MainPageTile {
id: devicesSubProxyConnectables
engine: _engine
parentProxy: thingsProxy
shownInterfaces: ["connectable"]
filterDisconnected: true
}
ThingsProxy {