diff --git a/libnymea-app/types/interfaces.cpp b/libnymea-app/types/interfaces.cpp index f2a7aede..40cf3c2b 100644 --- a/libnymea-app/types/interfaces.cpp +++ b/libnymea-app/types/interfaces.cpp @@ -98,9 +98,15 @@ Interfaces::Interfaces(QObject *parent) : QAbstractListModel(parent) addInterface("closablesensor", tr("Closable sensors"), {"sensor"}); addStateType("closablesensor", "closed", QVariant::Bool, false, tr("Closed"), tr("Opened or closed")); + addInterface("cosensor", tr("CO sensor"), {"sensor"}); + addStateType("cosensor", "co2", QVariant::Double, false, tr("CO level"), tr("CO level changed")); + addInterface("co2sensor", tr("CO2 sensor"), {"sensor"}); addStateType("co2sensor", "co2", QVariant::Double, false, tr("CO2 level"), tr("CO2 level changed")); + addInterface("gassensor", tr("Flammable gas sensor"), {"sensor"}); + addStateType("gassensor", "co2", QVariant::Double, false, tr("Flammable gas level"), tr("Flammable gas level changed")); + addInterface("power", tr("Powered things")); addStateType("power", "power", QVariant::Bool, true, tr("Thing is turned on"), tr("A thing is turned on or off"), tr("Turn things on or off")); diff --git a/nymea-app/images.qrc b/nymea-app/images.qrc index cb1c6dc2..8ba84fd5 100644 --- a/nymea-app/images.qrc +++ b/nymea-app/images.qrc @@ -268,5 +268,7 @@ ui/images/sensors/o2.svg ui/images/sensors/ph.svg ui/images/sensors/orp.svg + ui/images/sensors/co.svg + ui/images/sensors/gas.svg diff --git a/nymea-app/ui/Nymea.qml b/nymea-app/ui/Nymea.qml index 9b87fa7b..fcbb99fc 100644 --- a/nymea-app/ui/Nymea.qml +++ b/nymea-app/ui/Nymea.qml @@ -193,8 +193,12 @@ ApplicationWindow { return qsTr("Pressure"); case "noisesensor": return qsTr("Noise level"); + case "cosensor": + return qsTr("CO level") case "co2sensor": return qsTr("CO2 level") + case "gassensor": + return qsTr("Flammable gas level") case "inputtrigger": return qsTr("Incoming Events"); case "outputtrigger": @@ -285,8 +289,12 @@ ApplicationWindow { return Qt.resolvedUrl("images/sensors/pressure.svg") case "noisesensor": return Qt.resolvedUrl("images/sensors/noise.svg"); + case "cosensor": + return Qt.resolvedUrl("images/sensors/co.svg") case "co2sensor": return Qt.resolvedUrl("images/sensors/co2.svg") + case "gassensor": + return Qt.resolvedUrl("images/sensors/gas.svg") case "daylightsensor": return Qt.resolvedUrl("images/sensors/light.svg") case "presencesensor": diff --git a/nymea-app/ui/StyleBase.qml b/nymea-app/ui/StyleBase.qml index 96368b79..ada76b8c 100644 --- a/nymea-app/ui/StyleBase.qml +++ b/nymea-app/ui/StyleBase.qml @@ -74,7 +74,9 @@ Item { "conductivitysensor": "green", "pressuresensor": "grey", "noisesensor": "darkviolet", + "cosensor": "darkgray", "co2sensor": "turquoise", + "gassensor": "yellow", "daylightsensor": "gold", "presencesensor": "darkblue", "closablesensor": "green", diff --git a/nymea-app/ui/delegates/InterfaceTile.qml b/nymea-app/ui/delegates/InterfaceTile.qml index 90405f61..77392fa6 100644 --- a/nymea-app/ui/delegates/InterfaceTile.qml +++ b/nymea-app/ui/delegates/InterfaceTile.qml @@ -315,7 +315,9 @@ MainPageTile { ListElement { ifaceName: "closablesensor"; stateName: "closed" } ListElement { ifaceName: "lightsensor"; stateName: "lightIntensity" } ListElement { ifaceName: "watersensor"; stateName: "waterDetected" } + ListElement { ifaceName: "cosensor"; stateName: "co" } ListElement { ifaceName: "co2sensor"; stateName: "co2" } + ListElement { ifaceName: "gassensor"; stateName: "gas" } ListElement { ifaceName: "conductivity"; stateName: "conductivity" } ListElement { ifaceName: "noisesensor"; stateName: "noise" } ListElement { ifaceName: "smartmeterconsumer"; stateName: "totalEnergyConsumed" } diff --git a/nymea-app/ui/delegates/ThingTile.qml b/nymea-app/ui/delegates/ThingTile.qml index 8ebc9641..ea20f36d 100644 --- a/nymea-app/ui/delegates/ThingTile.qml +++ b/nymea-app/ui/delegates/ThingTile.qml @@ -179,9 +179,15 @@ MainPageTile { if (thing.thingClass.interfaces.indexOf("noisesensor") >= 0) { tmp.push({iface: "noisesensor", state: "noise"}); } + if (thing.thingClass.interfaces.indexOf("cosensor") >= 0) { + tmp.push({iface: "cosensor", state: "co"}); + } if (thing.thingClass.interfaces.indexOf("co2sensor") >= 0) { tmp.push({iface: "co2sensor", state: "co2"}); } + if (thing.thingClass.interfaces.indexOf("gassensor") >= 0) { + tmp.push({iface: "gassensor", state: "gas"}); + } if (thing.thingClass.interfaces.indexOf("smartmeterconsumer") >= 0) { tmp.push({iface: "smartmeterconsumer", state: "totalEnergyConsumed"}); } diff --git a/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml b/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml index 60bccb65..078d8d8b 100644 --- a/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml +++ b/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml @@ -79,7 +79,9 @@ ThingsListPageBase { ListElement { interfaceName: "lightsensor"; stateName: "lightIntensity" } ListElement { interfaceName: "conductivitysensor"; stateName: "conductivity" } ListElement { interfaceName: "noisesensor"; stateName: "noise" } + ListElement { interfaceName: "cosensor"; stateName: "co" } ListElement { interfaceName: "co2sensor"; stateName: "co2" } + ListElement { interfaceName: "gassensor"; stateName: "gas" } ListElement { interfaceName: "daylightsensor"; stateName: "daylight" } ListElement { interfaceName: "presencesensor"; stateName: "isPresent" } ListElement { interfaceName: "closablesensor"; stateName: "closed" } diff --git a/nymea-app/ui/devicepages/SensorDevicePage.qml b/nymea-app/ui/devicepages/SensorDevicePage.qml index 4106bca7..0919013b 100644 --- a/nymea-app/ui/devicepages/SensorDevicePage.qml +++ b/nymea-app/ui/devicepages/SensorDevicePage.qml @@ -56,7 +56,7 @@ ThingPageBase { Repeater { model: ListModel { Component.onCompleted: { - var supportedInterfaces = ["temperaturesensor", "humiditysensor", "pressuresensor", "moisturesensor", "lightsensor", "conductivitysensor", "noisesensor", "co2sensor", "presencesensor", "daylightsensor", "closablesensor", "watersensor", "phsensor", "o2sensor", "orpsensor"] + var supportedInterfaces = ["temperaturesensor", "humiditysensor", "pressuresensor", "moisturesensor", "lightsensor", "conductivitysensor", "noisesensor", "cosensor", "co2sensor", "gassensor", "presencesensor", "daylightsensor", "closablesensor", "watersensor", "phsensor", "o2sensor", "orpsensor"] for (var i = 0; i < supportedInterfaces.length; i++) { if (root.thingClass.interfaces.indexOf(supportedInterfaces[i]) >= 0) { append({name: supportedInterfaces[i]}); @@ -85,7 +85,9 @@ ThingPageBase { "lightsensor": "lightIntensity", "conductivitysensor": "conductivity", "noisesensor": "noise", + "cosensor": "co", "co2sensor": "co2", + "gassensor": "gas", "presencesensor": "isPresent", "daylightsensor": "daylight", "closablesensor": "closed", diff --git a/nymea-app/ui/images/sensors/co.svg b/nymea-app/ui/images/sensors/co.svg new file mode 100644 index 00000000..874e90d7 --- /dev/null +++ b/nymea-app/ui/images/sensors/co.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/nymea-app/ui/images/sensors/gas.svg b/nymea-app/ui/images/sensors/gas.svg new file mode 100644 index 00000000..7e4f3f77 --- /dev/null +++ b/nymea-app/ui/images/sensors/gas.svg @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + +