diff --git a/libnymea-app-core/devicemanager.cpp b/libnymea-app-core/devicemanager.cpp index bd358724..cb932494 100644 --- a/libnymea-app-core/devicemanager.cpp +++ b/libnymea-app-core/devicemanager.cpp @@ -216,7 +216,7 @@ void DeviceManager::getConfiguredDevicesResponse(const QVariantMap ¶ms) foreach (QVariant deviceVariant, deviceList) { Device *device = JsonTypes::unpackDevice(deviceVariant.toMap(), m_deviceClasses); if (!device) { - qWarning() << "Error unpacking device" << deviceVariant; + qWarning() << "Error unpacking device" << deviceVariant.toMap().value("name").toString(); continue; } @@ -238,7 +238,7 @@ void DeviceManager::getConfiguredDevicesResponse(const QVariantMap ¶ms) value.convert(QVariant::Int); } device->setStateValue(stateTypeId, value); -// qDebug() << "Set device state value:" << device->stateValue(stateTypeId) << value; + qDebug() << "Set device state value:" << device->stateValue(stateTypeId) << value; } devices()->addDevice(device); } diff --git a/libnymea-app-core/jsonrpc/jsontypes.cpp b/libnymea-app-core/jsonrpc/jsontypes.cpp index b22a6fb2..bcc71202 100644 --- a/libnymea-app-core/jsonrpc/jsontypes.cpp +++ b/libnymea-app-core/jsonrpc/jsontypes.cpp @@ -573,6 +573,8 @@ QPair JsonTypes::stringToUnit(const QString &unitString) return QPair(Types::UnitKiloWattHour, "kWh"); } else if (unitString == "UnitPercentage") { return QPair(Types::UnitPercentage, "%"); + } else if (unitString == "UnitPartsPerMillion") { + return QPair(Types::UnitPartsPerMillion, "ppm"); } else if (unitString == "UnitEuro") { return QPair(Types::UnitEuro, "€"); } else if (unitString == "UnitDollar") { diff --git a/libnymea-common/types/types.h b/libnymea-common/types/types.h index fa168465..0434925e 100644 --- a/libnymea-common/types/types.h +++ b/libnymea-common/types/types.h @@ -82,11 +82,12 @@ public: UnitKiloWatt, UnitKiloWattHour, UnitPercentage, + UnitPartsPerMillion, UnitEuro, UnitDollar }; - Types(QObject *parent = 0); + Types(QObject *parent = nullptr); }; #endif // TYPES_H diff --git a/nymea-app/images.qrc b/nymea-app/images.qrc index 92a8f823..a5c271a4 100644 --- a/nymea-app/images.qrc +++ b/nymea-app/images.qrc @@ -159,5 +159,7 @@ ui/images/lighting/relax.svg ui/images/messaging-app-symbolic.svg ui/images/mqtt.svg + ui/images/sensors/co2.svg + ui/images/sensors/noise.svg diff --git a/nymea-app/styles/dark/ApplicationWindow.qml b/nymea-app/styles/dark/ApplicationWindow.qml index 25256474..dd0c657d 100644 --- a/nymea-app/styles/dark/ApplicationWindow.qml +++ b/nymea-app/styles/dark/ApplicationWindow.qml @@ -30,7 +30,13 @@ ApplicationWindow { "moisturesensor":"blue", "lightsensor": "orange", "conductivitysensor": "green", - "pressuresensor": "grey" + "pressuresensor": "grey", + "noisesensor": "darkviolet", + "co2sensor": "turquoise", + "smartmeterproducer": "lightgreen", + "smartmeterconsumer": "orange", + "extendedsmartmeterproducer": "blue", + "extendedsmartmeterconsumer": "blue" } // Optional: Set this to override the cloud environment diff --git a/nymea-app/styles/light/ApplicationWindow.qml b/nymea-app/styles/light/ApplicationWindow.qml index 001b0667..462925dc 100644 --- a/nymea-app/styles/light/ApplicationWindow.qml +++ b/nymea-app/styles/light/ApplicationWindow.qml @@ -28,7 +28,13 @@ ApplicationWindow { "moisturesensor":"blue", "lightsensor": "orange", "conductivitysensor": "green", - "pressuresensor": "grey" + "pressuresensor": "grey", + "noisesensor": "darkviolet", + "co2sensor": "turquoise", + "smartmeterproducer": "lightgreen", + "smartmeterconsumer": "orange", + "extendedsmartmeterproducer": "blue", + "extendedsmartmeterconsumer": "blue" } // Optional: Set this to override the cloud environment diff --git a/nymea-app/ui/Nymea.qml b/nymea-app/ui/Nymea.qml index 5a948bfe..939f8344 100644 --- a/nymea-app/ui/Nymea.qml +++ b/nymea-app/ui/Nymea.qml @@ -76,6 +76,10 @@ ApplicationWindow { return qsTr("Humidity"); case "pressuresensor": return qsTr("Pressure"); + case "noisesensor": + return qsTr("Noise level"); + case "co2sensor": + return qsTr("CO2 level") case "inputtrigger": return qsTr("Incoming Events"); case "outputtrigger": @@ -141,6 +145,10 @@ ApplicationWindow { return Qt.resolvedUrl("images/sensors/conductivity.svg") case "pressuresensor": return Qt.resolvedUrl("images/sensors/pressure.svg") + case "noisesensor": + return Qt.resolvedUrl("images/sensors/noise.svg"); + case "co2sensor": + return Qt.resolvedUrl("images/sensors/co2.svg") case "media": case "mediacontroller": return Qt.resolvedUrl("images/mediaplayer-app-symbolic.svg") @@ -151,10 +159,6 @@ ApplicationWindow { return Qt.resolvedUrl("images/system-shutdown.svg") case "weather": return Qt.resolvedUrl("images/weather-app-symbolic.svg") - case "temperaturesensor": - return Qt.resolvedUrl("images/sensors/temperature.svg") - case "humiditysensor": - return Qt.resolvedUrl("images/sensors/humidity.svg") case "gateway": return Qt.resolvedUrl("images/network-wired-symbolic.svg") case "notifications": @@ -210,6 +214,8 @@ ApplicationWindow { "lightsensor": "orange", "conductivitysensor": "green", "pressuresensor": "grey", + "noisesensor": "darkviolet", + "co2sensor": "turquoise", "smartmeterproducer": "lightgreen", "smartmeterconsumer": "orange", "extendedsmartmeterproducer": "blue", diff --git a/nymea-app/ui/customviews/GenericTypeGraph.qml b/nymea-app/ui/customviews/GenericTypeGraph.qml index cca5f4bc..8137884e 100644 --- a/nymea-app/ui/customviews/GenericTypeGraph.qml +++ b/nymea-app/ui/customviews/GenericTypeGraph.qml @@ -36,7 +36,7 @@ Item { id: connectedLogsModel engine: root.hasConnectable ? _engine : null // don't even try to poll if we don't have a connectable interface deviceId: root.device.id - typeIds: [root.connectedStateType.id] + typeIds: root.hasConnectable ? [root.connectedStateType.id] : [] live: true graphSeries: connectedLineSeries viewStartTime: xAxis.min diff --git a/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml b/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml index 469e7e92..edb6d39e 100644 --- a/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml +++ b/nymea-app/ui/devicelistpages/SensorsDeviceListPage.qml @@ -80,6 +80,8 @@ DeviceListPageBase { ListElement { interfaceName: "pressuresensor"; stateName: "pressure" } ListElement { interfaceName: "lightsensor"; stateName: "lightIntensity" } ListElement { interfaceName: "conductivitysensor"; stateName: "conductivity" } + ListElement { interfaceName: "noisesensor"; stateName: "noise" } + ListElement { interfaceName: "co2sensor"; stateName: "co2" } } delegate: RowLayout { diff --git a/nymea-app/ui/devicepages/GenericDevicePage.qml b/nymea-app/ui/devicepages/GenericDevicePage.qml index c8918ed4..6511cb5a 100644 --- a/nymea-app/ui/devicepages/GenericDevicePage.qml +++ b/nymea-app/ui/devicepages/GenericDevicePage.qml @@ -46,6 +46,12 @@ DevicePageBase { break; case "temperaturesensor": case "humiditysensor": + case "moisturesensor": + case "lightsensor": + case "conductivitysensor": + case "pressuresensor": + case "noisesensor": + case "co2sensor": src = "SensorView.qml" options.interfaceName = modelData; break; @@ -61,7 +67,7 @@ DevicePageBase { // Ignore interfaces without any states/actions break; default: - print("unhandled interface", modelData) + print("WARNING: Unhandled interface", modelData) interfaceViewsRepeater.unhandledInterface = true } diff --git a/nymea-app/ui/devicepages/SensorDevicePagePost110.qml b/nymea-app/ui/devicepages/SensorDevicePagePost110.qml index bd4330df..cb8a6b39 100644 --- a/nymea-app/ui/devicepages/SensorDevicePagePost110.qml +++ b/nymea-app/ui/devicepages/SensorDevicePagePost110.qml @@ -9,7 +9,7 @@ ListView { anchors { fill: parent } model: ListModel { Component.onCompleted: { - var supportedInterfaces = ["temperaturesensor", "humiditysensor", "pressuresensor", "moisturesensor", "lightsensor", "conductivitysensor"] + var supportedInterfaces = ["temperaturesensor", "humiditysensor", "pressuresensor", "moisturesensor", "lightsensor", "conductivitysensor", "noisesensor", "co2sensor"] for (var i = 0; i < supportedInterfaces.length; i++) { print("checking", root.deviceClass.name, root.deviceClass.interfaces) if (root.deviceClass.interfaces.indexOf(supportedInterfaces[i]) >= 0) { diff --git a/nymea-app/ui/devicepages/SensorDevicePagePre110.qml b/nymea-app/ui/devicepages/SensorDevicePagePre110.qml index 3b15028f..a8e1947e 100644 --- a/nymea-app/ui/devicepages/SensorDevicePagePre110.qml +++ b/nymea-app/ui/devicepages/SensorDevicePagePre110.qml @@ -13,7 +13,7 @@ ListView { model: ListModel { Component.onCompleted: { - var supportedInterfaces = ["temperaturesensor", "humiditysensor", "pressuresensor", "moisturesensor", "lightsensor", "conductivitysensor"] + var supportedInterfaces = ["temperaturesensor", "humiditysensor", "pressuresensor", "moisturesensor", "lightsensor", "conductivitysensor", "noisesensor", "co2sensor"] for (var i = 0; i < supportedInterfaces.length; i++) { print("checking", root.deviceClass.name, root.deviceClass.interfaces) if (root.deviceClass.interfaces.indexOf(supportedInterfaces[i]) >= 0) { diff --git a/nymea-app/ui/images/sensors/co2.svg b/nymea-app/ui/images/sensors/co2.svg new file mode 100644 index 00000000..874e90d7 --- /dev/null +++ b/nymea-app/ui/images/sensors/co2.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/nymea-app/ui/images/sensors/noise.svg b/nymea-app/ui/images/sensors/noise.svg new file mode 100644 index 00000000..06c0db61 --- /dev/null +++ b/nymea-app/ui/images/sensors/noise.svg @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/nymea-app/ui/mainviews/FavoritesView.qml b/nymea-app/ui/mainviews/FavoritesView.qml index 3de1de6d..abfe3d5d 100644 --- a/nymea-app/ui/mainviews/FavoritesView.qml +++ b/nymea-app/ui/mainviews/FavoritesView.qml @@ -279,6 +279,12 @@ Item { if (deviceClass.interfaces.indexOf("conductivitysensor") >= 0) { tmp.push({iface: "conductivitysensor", state: "conductivity"}); } + if (deviceClass.interfaces.indexOf("noisesensor") >= 0) { + tmp.push({iface: "noisesensor", state: "noise"}); + } + if (deviceClass.interfaces.indexOf("co2sensor") >= 0) { + tmp.push({iface: "co2sensor", state: "co2"}); + } if (deviceClass.interfaces.indexOf("weather") >= 0) { tmp.push({iface: "temperaturesensor", state: "temperature"}); tmp.push({iface: "humiditysensor", state: "humidity"});