add a power interface and use that for lights
This commit is contained in:
parent
167ac6f3c3
commit
213db704a4
@ -25,6 +25,7 @@
|
|||||||
<file>connectable.json</file>
|
<file>connectable.json</file>
|
||||||
<file>inputtrigger.json</file>
|
<file>inputtrigger.json</file>
|
||||||
<file>outputtrigger.json</file>
|
<file>outputtrigger.json</file>
|
||||||
|
<file>power.json</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/"/>
|
<qresource prefix="/"/>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@ -1,9 +1,3 @@
|
|||||||
{
|
{
|
||||||
"states": [
|
"extends": "power"
|
||||||
{
|
|
||||||
"name": "power",
|
|
||||||
"type": "bool",
|
|
||||||
"writable": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
9
libguh/interfaces/power.json
Normal file
9
libguh/interfaces/power.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"states": [
|
||||||
|
{
|
||||||
|
"name": "power",
|
||||||
|
"type": "bool",
|
||||||
|
"writable": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -241,11 +241,12 @@ void TestDevices::verifyInterfaces()
|
|||||||
QVERIFY(!mockDevice.isEmpty());
|
QVERIFY(!mockDevice.isEmpty());
|
||||||
|
|
||||||
QVariantList interfaces = mockDevice.value("interfaces").toList();
|
QVariantList interfaces = mockDevice.value("interfaces").toList();
|
||||||
// Must contain gateway, light and battery, but must not contain mediacontroller as the device manager should filter
|
// Must contain gateway, power, light and battery, but must not contain mediacontroller as the device manager should filter
|
||||||
// that away because it doesn't implement all the required states.
|
// that away because it doesn't implement all the required states.
|
||||||
QCOMPARE(interfaces.count(), 3);
|
QCOMPARE(interfaces.count(), 4);
|
||||||
QVERIFY(interfaces.contains("gateway"));
|
QVERIFY(interfaces.contains("gateway"));
|
||||||
QVERIFY(interfaces.contains("battery"));
|
QVERIFY(interfaces.contains("battery"));
|
||||||
|
QVERIFY(interfaces.contains("power"));
|
||||||
QVERIFY(interfaces.contains("light"));
|
QVERIFY(interfaces.contains("light"));
|
||||||
QVERIFY(!interfaces.contains("mediacontroller"));
|
QVERIFY(!interfaces.contains("mediacontroller"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user