diff --git a/libguh/interfaces/interfaces.qrc b/libguh/interfaces/interfaces.qrc index 326b6e49..60fac03b 100644 --- a/libguh/interfaces/interfaces.qrc +++ b/libguh/interfaces/interfaces.qrc @@ -25,6 +25,7 @@ connectable.json inputtrigger.json outputtrigger.json + power.json diff --git a/libguh/interfaces/light.json b/libguh/interfaces/light.json index 160f9432..73187c21 100644 --- a/libguh/interfaces/light.json +++ b/libguh/interfaces/light.json @@ -1,9 +1,3 @@ { - "states": [ - { - "name": "power", - "type": "bool", - "writable": true - } - ] + "extends": "power" } diff --git a/libguh/interfaces/power.json b/libguh/interfaces/power.json new file mode 100644 index 00000000..160f9432 --- /dev/null +++ b/libguh/interfaces/power.json @@ -0,0 +1,9 @@ +{ + "states": [ + { + "name": "power", + "type": "bool", + "writable": true + } + ] +} diff --git a/tests/auto/devices/testdevices.cpp b/tests/auto/devices/testdevices.cpp index fb6eee43..1530cbc1 100644 --- a/tests/auto/devices/testdevices.cpp +++ b/tests/auto/devices/testdevices.cpp @@ -241,11 +241,12 @@ void TestDevices::verifyInterfaces() QVERIFY(!mockDevice.isEmpty()); 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. - QCOMPARE(interfaces.count(), 3); + QCOMPARE(interfaces.count(), 4); QVERIFY(interfaces.contains("gateway")); QVERIFY(interfaces.contains("battery")); + QVERIFY(interfaces.contains("power")); QVERIFY(interfaces.contains("light")); QVERIFY(!interfaces.contains("mediacontroller")); }