diff --git a/libnymea-app/zigbee/zigbeemanager.cpp b/libnymea-app/zigbee/zigbeemanager.cpp index c420d309..5c114dff 100644 --- a/libnymea-app/zigbee/zigbeemanager.cpp +++ b/libnymea-app/zigbee/zigbeemanager.cpp @@ -97,6 +97,13 @@ void ZigbeeManager::setPermitJoin(const QUuid &networkUuid, uint duration) m_client->sendCommand("Zigbee.SetPermitJoin", params, this, "setPermitJoinResponse"); } +void ZigbeeManager::factoryResetNetwork(const QUuid &networkUuid) +{ + QVariantMap params; + params.insert("networkUuid", networkUuid); + m_client->sendCommand("Zigbee.FactoryResetNetwork", params, this, "factoryResetNetworkResponse"); +} + void ZigbeeManager::init() { // FIXME: load only when used @@ -145,6 +152,11 @@ void ZigbeeManager::setPermitJoinResponse(int commandId, const QVariantMap ¶ qDebug() << "Zigbee set permit join network response" << commandId << params; } +void ZigbeeManager::factoryResetNetworkResponse(int commandId, const QVariantMap ¶ms) +{ + qDebug() << "Zigbee factory reset network response" << commandId << params; +} + void ZigbeeManager::notificationReceived(const QVariantMap ¬ification) { QString notificationString = notification.value("notification").toString(); diff --git a/libnymea-app/zigbee/zigbeemanager.h b/libnymea-app/zigbee/zigbeemanager.h index 443872c0..e09c61ed 100644 --- a/libnymea-app/zigbee/zigbeemanager.h +++ b/libnymea-app/zigbee/zigbeemanager.h @@ -58,6 +58,7 @@ public: Q_INVOKABLE void addNetwork(const QString &serialPort, uint baudRate, ZigbeeAdapter::ZigbeeBackendType backendType); Q_INVOKABLE void removeNetwork(const QUuid &networkUuid); Q_INVOKABLE void setPermitJoin(const QUuid &networkUuid, uint duration = 120); + Q_INVOKABLE void factoryResetNetwork(const QUuid &networkUuid); void init(); @@ -70,6 +71,7 @@ private: Q_INVOKABLE void addNetworkResponse(int commandId, const QVariantMap ¶ms); Q_INVOKABLE void removeNetworkResponse(int commandId, const QVariantMap ¶ms); Q_INVOKABLE void setPermitJoinResponse(int commandId, const QVariantMap ¶ms); + Q_INVOKABLE void factoryResetNetworkResponse(int commandId, const QVariantMap ¶ms); Q_INVOKABLE void notificationReceived(const QVariantMap ¬ification); diff --git a/nymea-app/ui/system/ZigbeeNetworkInfoPage.qml b/nymea-app/ui/system/ZigbeeNetworkInfoPage.qml index e3a002f9..226f40f1 100644 --- a/nymea-app/ui/system/ZigbeeNetworkInfoPage.qml +++ b/nymea-app/ui/system/ZigbeeNetworkInfoPage.qml @@ -114,7 +114,10 @@ SettingsPageBase { Layout.leftMargin: app.margins Layout.rightMargin: app.margins text: qsTr("Factory reset controller") - onClicked: print("Reset clicked") + onClicked: { + engine.zigbeeManager.factoryResetNetwork(root.network.networkUuid) + pageStack.pop() + } } }