diff --git a/libnymea-app/thingsproxy.cpp b/libnymea-app/thingsproxy.cpp index 21c54f87..e992ba92 100644 --- a/libnymea-app/thingsproxy.cpp +++ b/libnymea-app/thingsproxy.cpp @@ -236,7 +236,6 @@ QList ThingsProxy::hiddenThingClassIds() const void ThingsProxy::setHiddenThingClassIds(const QList &hiddenThingClassIds) { - qCritical() << "SetHiddenThingClassIds" << hiddenThingClassIds; if (m_hiddenThingClassIds != hiddenThingClassIds) { m_hiddenThingClassIds = hiddenThingClassIds; emit hiddenThingClassIdsChanged(); @@ -244,6 +243,20 @@ void ThingsProxy::setHiddenThingClassIds(const QList &hiddenThingClassIds } } +QList ThingsProxy::hiddenThingIds() const +{ + return m_hiddenThingIds; +} + +void ThingsProxy::setHiddenThingIds(const QList &hiddenThingIds) +{ + if (m_hiddenThingIds != hiddenThingIds) { + m_hiddenThingIds = hiddenThingIds; + emit hiddenThingIdsChanged(); + invalidateFilterInternal(); + } +} + QString ThingsProxy::requiredEventName() const { return m_requiredEventName; @@ -606,6 +619,10 @@ bool ThingsProxy::filterAcceptsRow(int source_row, const QModelIndex &source_par return false; } + if (m_hiddenThingIds.contains(thing->id())) { + return false; + } + if (m_showDigitalInputs || m_showDigitalOutputs || m_showAnalogInputs || m_showAnalogOutputs) { if (m_showDigitalInputs && thingClass->stateTypes()->ioStateTypes(Types::IOTypeDigitalInput).isEmpty()) { return false; diff --git a/libnymea-app/thingsproxy.h b/libnymea-app/thingsproxy.h index dab6f1d5..debb039e 100644 --- a/libnymea-app/thingsproxy.h +++ b/libnymea-app/thingsproxy.h @@ -56,6 +56,7 @@ class ThingsProxy : public QSortFilterProxyModel Q_PROPERTY(QList shownThingClassIds READ shownThingClassIds WRITE setShownThingClassIds NOTIFY shownThingClassIdsChanged) Q_PROPERTY(QList hiddenThingClassIds READ hiddenThingClassIds WRITE setHiddenThingClassIds NOTIFY hiddenThingClassIdsChanged) + Q_PROPERTY(QList hiddenThingIds READ hiddenThingIds WRITE setHiddenThingIds NOTIFY hiddenThingIdsChanged) Q_PROPERTY(QString requiredEventName READ requiredEventName WRITE setRequiredEventName NOTIFY requiredEventNameChanged) Q_PROPERTY(QString requiredStateName READ requiredStateName WRITE setRequiredStateName NOTIFY requiredStateNameChanged) @@ -127,6 +128,9 @@ public: QList hiddenThingClassIds() const; void setHiddenThingClassIds(const QList &hiddenThingClassIds); + QList hiddenThingIds() const; + void setHiddenThingIds(const QList &hiddenThingIds); + QString requiredEventName() const; void setRequiredEventName(const QString &requiredEventName); @@ -188,6 +192,7 @@ signals: void nameFilterChanged(); void shownThingClassIdsChanged(); void hiddenThingClassIdsChanged(); + void hiddenThingIdsChanged(); void requiredEventNameChanged(); void requiredStateNameChanged(); void requiredActionNameChanged(); @@ -223,6 +228,7 @@ private: QString m_nameFilter; QList m_shownThingClassIds; QList m_hiddenThingClassIds; + QList m_hiddenThingIds; QString m_requiredEventName; QString m_requiredStateName; diff --git a/nymea-app/ui/Nymea.qml b/nymea-app/ui/Nymea.qml index c8b87267..4aa630a8 100644 --- a/nymea-app/ui/Nymea.qml +++ b/nymea-app/ui/Nymea.qml @@ -367,9 +367,9 @@ ApplicationWindow { case "smartmeter": case "smartmeterconsumer": case "smartmeterproducer": - return Qt.resolvedUrl("images/smartmeter.svg") case "energymeter": - return Qt.resolvedUrl("images/energy.svg") + return Qt.resolvedUrl("images/smartmeter.svg") +// return Qt.resolvedUrl("images/energy.svg") case "heating": return Qt.resolvedUrl("images/thermostat/heating.svg") case "cooling": diff --git a/nymea-app/ui/delegates/InterfaceTile.qml b/nymea-app/ui/delegates/InterfaceTile.qml index feae621c..1982f4ec 100644 --- a/nymea-app/ui/delegates/InterfaceTile.qml +++ b/nymea-app/ui/delegates/InterfaceTile.qml @@ -323,8 +323,8 @@ MainPageTile { ListElement { ifaceName: "gassensor"; stateName: "gas" } ListElement { ifaceName: "conductivity"; stateName: "conductivity" } ListElement { ifaceName: "noisesensor"; stateName: "noise" } - ListElement { ifaceName: "smartmeterconsumer"; stateName: "totalEnergyConsumed" } - ListElement { ifaceName: "smartmeterproducer"; stateName: "totalEnergyProduced" } + ListElement { ifaceName: "smartmeterconsumer"; stateName: "currentPower" } + ListElement { ifaceName: "smartmeterproducer"; stateName: "currentPower" } ListElement { ifaceName: "energymeter"; stateName: "currentPower" } ListElement { ifaceName: "thermostat"; stateName: "targetTemperature" } ListElement { ifaceName: "heating"; stateName: "power" } diff --git a/nymea-app/ui/delegates/ThingTile.qml b/nymea-app/ui/delegates/ThingTile.qml index b8420799..0d759e2d 100644 --- a/nymea-app/ui/delegates/ThingTile.qml +++ b/nymea-app/ui/delegates/ThingTile.qml @@ -242,10 +242,13 @@ MainPageTile { tmp.push({iface: "gassensor", state: "gas"}); } if (thing.thingClass.interfaces.indexOf("smartmeterconsumer") >= 0) { - tmp.push({iface: "smartmeterconsumer", state: "totalEnergyConsumed"}); + tmp.push({iface: "smartmeterconsumer", state: "currentPower"}); } if (thing.thingClass.interfaces.indexOf("smartmeterproducer") >= 0) { - tmp.push({iface: "smartmeterproducer", state: "totalEnergyProduced"}); + tmp.push({iface: "smartmeterproducer", state: "currentPower"}); + } + if (thing.thingClass.interfaces.indexOf("energymeter") >= 0) { + tmp.push({iface: "energymeter", state: "currentPower"}); } if (thing.thingClass.interfaces.indexOf("daylightsensor") >= 0) { tmp.push({iface: "daylightsensor", state: "daylight"}); diff --git a/nymea-app/ui/mainviews/EnergyView.qml b/nymea-app/ui/mainviews/EnergyView.qml index b782043a..9e17ee51 100644 --- a/nymea-app/ui/mainviews/EnergyView.qml +++ b/nymea-app/ui/mainviews/EnergyView.qml @@ -73,8 +73,9 @@ MainViewBase { ThingsProxy { id: consumers engine: _engine - shownInterfaces: ["smartmeterconsumer"] + shownInterfaces: ["smartmeterconsumer", "energymeter"] hideTagId: "hiddenInEnergyView" + hiddenThingIds: [energyManager.rootMeterId] } ThingsProxy { diff --git a/nymea-app/ui/mainviews/energy/EnergySettingsPage.qml b/nymea-app/ui/mainviews/energy/EnergySettingsPage.qml index 14a0c35e..d6f6545b 100644 --- a/nymea-app/ui/mainviews/energy/EnergySettingsPage.qml +++ b/nymea-app/ui/mainviews/energy/EnergySettingsPage.qml @@ -10,6 +10,11 @@ SettingsPageBase { property EnergyManager energyManager: null + property ThingsProxy allConsumers: ThingsProxy { + engine: _engine + shownInterfaces: ["smartmeterconsumer", "energymeter"] + hiddenThingIds: [energyManager.rootMeterId] + } SettingsPageSectionHeader { @@ -57,10 +62,7 @@ SettingsPageBase { } Repeater { - model: ThingsProxy { - engine: _engine - shownInterfaces: ["smartmeterconsumer"] - } + model: root.allConsumers delegate: CheckDelegate { Layout.fillWidth: true text: model.name