Merge PR #365: Zigbee node JSON RPC API

This commit is contained in:
Jenkins nymea 2021-07-06 17:18:14 +02:00
commit 152255d45c
6 changed files with 694 additions and 360 deletions

View File

@ -44,6 +44,8 @@ ZigbeeHandler::ZigbeeHandler(ZigbeeManager *zigbeeManager, QObject *parent) :
qRegisterMetaType<nymeaserver::ZigbeeAdapter>(); qRegisterMetaType<nymeaserver::ZigbeeAdapter>();
registerEnum<ZigbeeManager::ZigbeeNetworkState>(); registerEnum<ZigbeeManager::ZigbeeNetworkState>();
registerEnum<ZigbeeManager::ZigbeeError>(); registerEnum<ZigbeeManager::ZigbeeError>();
registerEnum<ZigbeeManager::ZigbeeNodeType>();
registerEnum<ZigbeeManager::ZigbeeNodeState>();
registerObject<ZigbeeAdapter, ZigbeeAdapters>(); registerObject<ZigbeeAdapter, ZigbeeAdapters>();
// Network object describing a network instance // Network object describing a network instance
@ -64,6 +66,22 @@ ZigbeeHandler::ZigbeeHandler(ZigbeeManager *zigbeeManager, QObject *parent) :
zigbeeNetworkDescription.insert("networkState", enumRef<ZigbeeManager::ZigbeeNetworkState>()); zigbeeNetworkDescription.insert("networkState", enumRef<ZigbeeManager::ZigbeeNetworkState>());
registerObject("ZigbeeNetwork", zigbeeNetworkDescription); registerObject("ZigbeeNetwork", zigbeeNetworkDescription);
// Zigbee node description
QVariantMap zigbeeNodeDescription;
zigbeeNodeDescription.insert("networkUuid", enumValueName(Uuid));
zigbeeNodeDescription.insert("ieeeAddress", enumValueName(String));
zigbeeNodeDescription.insert("networkAddress", enumValueName(Uint));
zigbeeNodeDescription.insert("type", enumRef<ZigbeeManager::ZigbeeNodeType>());
zigbeeNodeDescription.insert("state", enumRef<ZigbeeManager::ZigbeeNodeState>());
zigbeeNodeDescription.insert("manufacturer", enumValueName(String));
zigbeeNodeDescription.insert("model", enumValueName(String));
zigbeeNodeDescription.insert("version", enumValueName(String));
zigbeeNodeDescription.insert("receiverOnWhileIdle", enumValueName(Bool));
zigbeeNodeDescription.insert("reachable", enumValueName(Bool));
zigbeeNodeDescription.insert("lqi", enumValueName(Uint));
zigbeeNodeDescription.insert("lastSeen", enumValueName(Uint));
registerObject("ZigbeeNode", zigbeeNodeDescription);
QVariantMap params, returns; QVariantMap params, returns;
QString description; QString description;
@ -163,6 +181,44 @@ ZigbeeHandler::ZigbeeHandler(ZigbeeManager *zigbeeManager, QObject *parent) :
returns.insert("zigbeeError", enumRef<ZigbeeManager::ZigbeeError>()); returns.insert("zigbeeError", enumRef<ZigbeeManager::ZigbeeError>());
registerMethod("SetPermitJoin", description, params, returns); registerMethod("SetPermitJoin", description, params, returns);
// GetNodes
params.clear(); returns.clear();
description = "Returns the list of ZigBee nodes from the network the given \'networkUuid\' in the system.";
params.insert("networkUuid", enumValueName(Uuid));
returns.insert("zigbeeError", enumRef<ZigbeeManager::ZigbeeError>());
returns.insert("o:zigbeeNodes", QVariantList() << objectRef("ZigbeeNode"));
registerMethod("GetNodes", description, params, returns);
// RemoveNode
params.clear(); returns.clear();
description = "Remove a ZigBee node with the given \'ieeeAddress\' from the network with the given \'networkUuid\'. "
"If there is a thing configured for this node, also the thing will be removed from the system. "
"The coordinator node cannot be removed.";
params.insert("networkUuid", enumValueName(Uuid));
params.insert("ieeeAddress", enumValueName(String));
returns.insert("zigbeeError", enumRef<ZigbeeManager::ZigbeeError>());
registerMethod("RemoveNode", description, params, returns);
// NodeAdded
params.clear();
description = "Emitted whenever a new ZigBee node has joined the network with the given \'networkUuid\'.";
params.insert("networkUuid", enumValueName(Uuid));
params.insert("zigbeeNode", objectRef("ZigbeeNode"));
registerNotification("NodeAdded", description, params);
// NodeRemoved
params.clear();
description = "Emitted whenever a ZigBee node has removed from the network with the given \'networkUuid\'.";
params.insert("networkUuid", enumValueName(Uuid));
params.insert("zigbeeNode", objectRef("ZigbeeNode"));
registerNotification("NodeRemoved", description, params);
// NodeChanged
params.clear();
description = "Emitted whenever a ZigBee node has changed.";
params.insert("networkUuid", enumValueName(Uuid));
params.insert("zigbeeNode", objectRef("ZigbeeNode"));
registerNotification("NodeChanged", description, params);
connect(m_zigbeeManager, &ZigbeeManager::availableAdapterAdded, this, [this](const ZigbeeAdapter &adapter){ connect(m_zigbeeManager, &ZigbeeManager::availableAdapterAdded, this, [this](const ZigbeeAdapter &adapter){
QVariantMap params; QVariantMap params;
@ -193,6 +249,12 @@ ZigbeeHandler::ZigbeeHandler(ZigbeeManager *zigbeeManager, QObject *parent) :
params.insert("networkUuid", networkUuid); params.insert("networkUuid", networkUuid);
emit NetworkRemoved(params); emit NetworkRemoved(params);
}); });
connect(m_zigbeeManager, &ZigbeeManager::nodeJoined, this, &ZigbeeHandler::onNodeJoined);
connect(m_zigbeeManager, &ZigbeeManager::nodeAdded, this, &ZigbeeHandler::onNodeAdded);
connect(m_zigbeeManager, &ZigbeeManager::nodeChanged, this, &ZigbeeHandler::onNodeChanged);
connect(m_zigbeeManager, &ZigbeeManager::nodeRemoved, this, &ZigbeeHandler::onNodeRemoved);
} }
QString ZigbeeHandler::name() const QString ZigbeeHandler::name() const
@ -206,9 +268,9 @@ JsonReply *ZigbeeHandler::GetAvailableBackends(const QVariantMap &params)
QVariantMap returnMap; QVariantMap returnMap;
QVariantList backendsList; QVariantList backendsList;
foreach (const QString &backendName, ZigbeeAdapter::backendNames().values()) foreach (const QString &backendName, ZigbeeAdapter::backendNames().values()) {
backendsList << backendName; backendsList << backendName;
}
returnMap.insert("backends", backendsList); returnMap.insert("backends", backendsList);
return createReply(returnMap); return createReply(returnMap);
} }
@ -278,6 +340,53 @@ JsonReply *ZigbeeHandler::SetPermitJoin(const QVariantMap &params)
return createReply(returnMap); return createReply(returnMap);
} }
JsonReply *ZigbeeHandler::GetNodes(const QVariantMap &params)
{
QVariantMap returnMap;
QUuid networkUuid = params.value("networkUuid").toUuid();
ZigbeeNetwork *network = m_zigbeeManager->zigbeeNetworks().value(networkUuid);
if (!network) {
returnMap.insert("zigbeeError", enumValueName<ZigbeeManager::ZigbeeError>(ZigbeeManager::ZigbeeErrorNetworkUuidNotFound));
return createReply(returnMap);
}
QVariantList nodeList;
foreach (ZigbeeNode *node, network->nodes()) {
nodeList << packNode(node);
}
returnMap.insert("zigbeeError", enumValueName<ZigbeeManager::ZigbeeError>(ZigbeeManager::ZigbeeErrorNoError));
returnMap.insert("zigbeeNodes", nodeList);
return createReply(returnMap);
}
JsonReply *ZigbeeHandler::RemoveNode(const QVariantMap &params)
{
QVariantMap returnMap;
QUuid networkUuid = params.value("networkUuid").toUuid();
ZigbeeAddress nodeAddress(params.value("ieeeAddress").toString());
ZigbeeNetwork *network = m_zigbeeManager->zigbeeNetworks().value(networkUuid);
if (!network) {
returnMap.insert("zigbeeError", enumValueName<ZigbeeManager::ZigbeeError>(ZigbeeManager::ZigbeeErrorNetworkUuidNotFound));
return createReply(returnMap);
}
if (!network->hasNode(nodeAddress)) {
returnMap.insert("zigbeeError", enumValueName<ZigbeeManager::ZigbeeError>(ZigbeeManager::ZigbeeErrorNodeNotFound));
return createReply(returnMap);
}
ZigbeeNode *node = network->getZigbeeNode(nodeAddress);
if (node->shortAddress() == 0x0000) {
returnMap.insert("zigbeeError", enumValueName<ZigbeeManager::ZigbeeError>(ZigbeeManager::ZigbeeErrorForbidden));
return createReply(returnMap);
}
network->removeZigbeeNode(nodeAddress);
returnMap.insert("zigbeeError", enumValueName<ZigbeeManager::ZigbeeError>(ZigbeeManager::ZigbeeErrorNoError));
return createReply(returnMap);
}
JsonReply *ZigbeeHandler::GetNetworks(const QVariantMap &params) JsonReply *ZigbeeHandler::GetNetworks(const QVariantMap &params)
{ {
Q_UNUSED(params) Q_UNUSED(params)
@ -338,4 +447,74 @@ QVariantMap ZigbeeHandler::packNetwork(ZigbeeNetwork *network)
return networkMap; return networkMap;
} }
QVariantMap ZigbeeHandler::packNode(ZigbeeNode *node)
{
QVariantMap nodeMap;
nodeMap.insert("networkUuid", node->networkUuid());
nodeMap.insert("ieeeAddress", node->extendedAddress().toString());
nodeMap.insert("networkAddress", node->shortAddress());
switch (node->nodeDescriptor().nodeType) {
case ZigbeeDeviceProfile::NodeTypeCoordinator:
nodeMap.insert("type", enumValueName<ZigbeeManager::ZigbeeNodeType>(ZigbeeManager::ZigbeeNodeTypeCoordinator));
break;
case ZigbeeDeviceProfile::NodeTypeRouter:
nodeMap.insert("type", enumValueName<ZigbeeManager::ZigbeeNodeType>(ZigbeeManager::ZigbeeNodeTypeRouter));
break;
default:
nodeMap.insert("type", enumValueName<ZigbeeManager::ZigbeeNodeType>(ZigbeeManager::ZigbeeNodeTypeEndDevice));
break;
}
switch (node->state()) {
case ZigbeeNode::StateUninitialized:
nodeMap.insert("state", enumValueName<ZigbeeManager::ZigbeeNodeState>(ZigbeeManager::ZigbeeNodeStateUninitialized));
break;
case ZigbeeNode::StateInitializing:
nodeMap.insert("state", enumValueName<ZigbeeManager::ZigbeeNodeState>(ZigbeeManager::ZigbeeNodeStateInitializing));
break;
case ZigbeeNode::StateInitialized:
nodeMap.insert("state", enumValueName<ZigbeeManager::ZigbeeNodeState>(ZigbeeManager::ZigbeeNodeStateInitialized));
break;
}
nodeMap.insert("manufacturer", node->manufacturerName());
nodeMap.insert("model", node->modelName());
nodeMap.insert("version", node->version());
nodeMap.insert("receiverOnWhileIdle", node->macCapabilities().receiverOnWhenIdle);
nodeMap.insert("reachable", node->reachable());
nodeMap.insert("lqi", node->lqi());
nodeMap.insert("lastSeen", node->lastSeen().toMSecsSinceEpoch() / 1000);
return nodeMap;
}
void ZigbeeHandler::onNodeJoined(const QUuid &networkUuid, ZigbeeNode *node)
{
QVariantMap params;
params.insert("networkUuid", networkUuid);
params.insert("zigbeeNode", packNode(node));
emit NodeAdded(params);
}
void ZigbeeHandler::onNodeAdded(const QUuid &networkUuid, ZigbeeNode *node)
{
// Note: we emit the node changed signal here, since the node has been added internally after initialization.
onNodeChanged(networkUuid, node);
}
void ZigbeeHandler::onNodeChanged(const QUuid &networkUuid, ZigbeeNode *node)
{
QVariantMap params;
params.insert("networkUuid", networkUuid);
params.insert("zigbeeNode", packNode(node));
emit NodeChanged(params);
}
void ZigbeeHandler::onNodeRemoved(const QUuid &networkUuid, ZigbeeNode *node)
{
QVariantMap params;
params.insert("networkUuid", networkUuid);
params.insert("zigbeeNode", packNode(node));
emit NodeRemoved(params);
}
} }

View File

@ -51,24 +51,39 @@ public:
Q_INVOKABLE JsonReply *GetAvailableBackends(const QVariantMap &params); Q_INVOKABLE JsonReply *GetAvailableBackends(const QVariantMap &params);
Q_INVOKABLE JsonReply *GetAdapters(const QVariantMap &params); Q_INVOKABLE JsonReply *GetAdapters(const QVariantMap &params);
Q_INVOKABLE JsonReply *GetNetworks(const QVariantMap &params); Q_INVOKABLE JsonReply *GetNetworks(const QVariantMap &params);
Q_INVOKABLE JsonReply *AddNetwork(const QVariantMap &params); Q_INVOKABLE JsonReply *AddNetwork(const QVariantMap &params);
Q_INVOKABLE JsonReply *RemoveNetwork(const QVariantMap &params); Q_INVOKABLE JsonReply *RemoveNetwork(const QVariantMap &params);
Q_INVOKABLE JsonReply *FactoryResetNetwork(const QVariantMap &params); Q_INVOKABLE JsonReply *FactoryResetNetwork(const QVariantMap &params);
Q_INVOKABLE JsonReply *SetPermitJoin(const QVariantMap &params); Q_INVOKABLE JsonReply *SetPermitJoin(const QVariantMap &params);
Q_INVOKABLE JsonReply *GetNodes(const QVariantMap &params);
Q_INVOKABLE JsonReply *RemoveNode(const QVariantMap &params);
QVariantMap packNetwork(ZigbeeNetwork *network); QVariantMap packNetwork(ZigbeeNetwork *network);
QVariantMap packNode(ZigbeeNode *node);
private: private:
ZigbeeManager *m_zigbeeManager = nullptr; ZigbeeManager *m_zigbeeManager = nullptr;
private slots:
void onNodeJoined(const QUuid &networkUuid, ZigbeeNode *node);
void onNodeAdded(const QUuid &networkUuid, ZigbeeNode *node);
void onNodeChanged(const QUuid &networkUuid, ZigbeeNode *node);
void onNodeRemoved(const QUuid &networkUuid, ZigbeeNode *node);
signals: signals:
void AdapterAdded(const QVariantMap &params); void AdapterAdded(const QVariantMap &params);
void AdapterRemoved(const QVariantMap &params); void AdapterRemoved(const QVariantMap &params);
void NetworkAdded(const QVariantMap &params); void NetworkAdded(const QVariantMap &params);
void NetworkRemoved(const QVariantMap &params); void NetworkRemoved(const QVariantMap &params);
void NetworkChanged(const QVariantMap &params); void NetworkChanged(const QVariantMap &params);
void NodeAdded(const QVariantMap &params);
void NodeRemoved(const QVariantMap &params);
void NodeChanged(const QVariantMap &params);
}; };
} }

View File

@ -205,8 +205,8 @@ ZigbeeManager::ZigbeeError ZigbeeManager::removeZigbeeNetwork(const QUuid &netwo
settings.beginGroup("ZigbeeNetworks"); settings.beginGroup("ZigbeeNetworks");
settings.beginGroup(network->networkUuid().toString()); settings.beginGroup(network->networkUuid().toString());
settings.remove(""); settings.remove("");
settings.endGroup(); settings.endGroup(); // networkUuid
settings.endGroup(); settings.endGroup(); // ZigbeeNetworks
qCDebug(dcZigbee()) << "Network removed successfully"; qCDebug(dcZigbee()) << "Network removed successfully";
return ZigbeeManager::ZigbeeErrorNoError; return ZigbeeManager::ZigbeeErrorNoError;
@ -343,19 +343,19 @@ void ZigbeeManager::loadZigbeeNetworks()
void ZigbeeManager::checkPlatformConfiguration() void ZigbeeManager::checkPlatformConfiguration()
{ {
/* Example platform configurations /* Example platform configurations
* *
* serialPort=/dev/ttymxc2 * serialPort=/dev/ttymxc2
* baudRate=115200 * baudRate=115200
* backend=nxp * backend=nxp
* autoSetup=false * autoSetup=false
* *
* serialPort=/dev/ttyS0 * serialPort=/dev/ttyS0
* baudRate=38400 * baudRate=38400
* backend=deconz * backend=deconz
* autoSetup=false * autoSetup=false
* *
* autoSetup=true * autoSetup=true
*/ */
QFileInfo platformConfigurationFileInfo(NymeaSettings::settingsPath() + QDir::separator() + "zigbee-platform.conf"); QFileInfo platformConfigurationFileInfo(NymeaSettings::settingsPath() + QDir::separator() + "zigbee-platform.conf");
if (platformConfigurationFileInfo.exists()) { if (platformConfigurationFileInfo.exists()) {
@ -544,6 +544,14 @@ void ZigbeeManager::addNetwork(ZigbeeNetwork *network)
emit nodeRemoved(network->networkUuid(), node); emit nodeRemoved(network->networkUuid(), node);
}); });
connect(network, &ZigbeeNetwork::nodeJoined, this, [this, network](ZigbeeNode *node){
// The node has joined but is still initializing. Once the node has been initialized by the stack, the node added signal will be emitted.
qCDebug(dcZigbee()) << "Node joined the network" << network->networkUuid().toString() << node;
emit nodeJoined(network->networkUuid(), node);
setupNodeSignals(node);
});
connect(network, &ZigbeeNetwork::firmwareVersionChanged, this, [this, network](const QString &firmwareVersion){ connect(network, &ZigbeeNetwork::firmwareVersionChanged, this, [this, network](const QString &firmwareVersion){
qCDebug(dcZigbee()) << "Network adapter firmware version changed for" << network << firmwareVersion; qCDebug(dcZigbee()) << "Network adapter firmware version changed for" << network << firmwareVersion;
emit zigbeeNetworkChanged(network); emit zigbeeNetworkChanged(network);
@ -583,6 +591,10 @@ void ZigbeeManager::addNetwork(ZigbeeNetwork *network)
} }
} }
} }
foreach (ZigbeeNode *node, network->nodes()) {
setupNodeSignals(node);
}
} }
ZigbeeAdapter ZigbeeManager::convertUartAdapterToAdapter(const ZigbeeUartAdapter &uartAdapter) ZigbeeAdapter ZigbeeManager::convertUartAdapterToAdapter(const ZigbeeUartAdapter &uartAdapter)
@ -628,5 +640,42 @@ void ZigbeeManager::evaluateZigbeeAvailable()
emit availableChanged(m_available); emit availableChanged(m_available);
} }
void ZigbeeManager::setupNodeSignals(ZigbeeNode *node)
{
// Connect signals while joining for initializing
connect(node, &ZigbeeNode::shortAddressChanged, this, [=](){
emit nodeChanged(node->networkUuid(), node);
});
connect(node, &ZigbeeNode::stateChanged, this, [=](){
emit nodeChanged(node->networkUuid(), node);
});
connect(node, &ZigbeeNode::manufacturerNameChanged, this, [=](){
emit nodeChanged(node->networkUuid(), node);
});
connect(node, &ZigbeeNode::modelNameChanged, this, [=](){
emit nodeChanged(node->networkUuid(), node);
});
connect(node, &ZigbeeNode::versionChanged, this, [=](){
emit nodeChanged(node->networkUuid(), node);
});
connect(node, &ZigbeeNode::lqiChanged, this, [=](){
emit nodeChanged(node->networkUuid(), node);
});
connect(node, &ZigbeeNode::lastSeenChanged, this, [=](){
emit nodeChanged(node->networkUuid(), node);
});
connect(node, &ZigbeeNode::reachableChanged, this, [=](){
emit nodeChanged(node->networkUuid(), node);
});
}
} }

View File

@ -60,10 +60,28 @@ public:
ZigbeeErrorNetworkUuidNotFound, ZigbeeErrorNetworkUuidNotFound,
ZigbeeErrorDurationOutOfRange, ZigbeeErrorDurationOutOfRange,
ZigbeeErrorNetworkOffline, ZigbeeErrorNetworkOffline,
ZigbeeErrorUnknownBackend ZigbeeErrorUnknownBackend,
ZigbeeErrorNodeNotFound,
ZigbeeErrorForbidden
}; };
Q_ENUM(ZigbeeError) Q_ENUM(ZigbeeError)
// Node information
enum ZigbeeNodeType {
ZigbeeNodeTypeCoordinator,
ZigbeeNodeTypeRouter,
ZigbeeNodeTypeEndDevice
};
Q_ENUM(ZigbeeNodeType)
enum ZigbeeNodeState {
ZigbeeNodeStateUninitialized,
ZigbeeNodeStateInitializing,
ZigbeeNodeStateInitialized,
ZigbeeNodeStateHandled
};
Q_ENUM(ZigbeeNodeState)
explicit ZigbeeManager(QObject *parent = nullptr); explicit ZigbeeManager(QObject *parent = nullptr);
bool available() const; bool available() const;
@ -96,6 +114,7 @@ private:
ZigbeeAdapter convertUartAdapterToAdapter(const ZigbeeUartAdapter &uartAdapter); ZigbeeAdapter convertUartAdapterToAdapter(const ZigbeeUartAdapter &uartAdapter);
void evaluateZigbeeAvailable(); void evaluateZigbeeAvailable();
void setupNodeSignals(ZigbeeNode *node);
signals: signals:
void availableChanged(bool available); void availableChanged(bool available);
@ -107,7 +126,9 @@ signals:
void zigbeeNetworkRemoved(const QUuid networkUuid); void zigbeeNetworkRemoved(const QUuid networkUuid);
void zigbeeNetworkChanged(ZigbeeNetwork *zigbeeNetwork); void zigbeeNetworkChanged(ZigbeeNetwork *zigbeeNetwork);
void nodeJoined(const QUuid &networkUuid, ZigbeeNode *node);
void nodeAdded(const QUuid &networkUuid, ZigbeeNode *node); void nodeAdded(const QUuid &networkUuid, ZigbeeNode *node);
void nodeChanged(const QUuid &networkUuid, ZigbeeNode *node);
void nodeRemoved(const QUuid &networkUuid, ZigbeeNode *node); void nodeRemoved(const QUuid &networkUuid, ZigbeeNode *node);
}; };

View File

@ -5,7 +5,7 @@ NYMEA_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"
# define protocol versions # define protocol versions
JSON_PROTOCOL_VERSION_MAJOR=5 JSON_PROTOCOL_VERSION_MAJOR=5
JSON_PROTOCOL_VERSION_MINOR=5 JSON_PROTOCOL_VERSION_MINOR=6
JSON_PROTOCOL_VERSION="$${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}" JSON_PROTOCOL_VERSION="$${JSON_PROTOCOL_VERSION_MAJOR}.$${JSON_PROTOCOL_VERSION_MINOR}"
LIBNYMEA_API_VERSION_MAJOR=7 LIBNYMEA_API_VERSION_MAJOR=7
LIBNYMEA_API_VERSION_MINOR=0 LIBNYMEA_API_VERSION_MINOR=0

View File

@ -1,4 +1,4 @@
5.5 5.6
{ {
"enums": { "enums": {
"BasicType": [ "BasicType": [
@ -377,7 +377,9 @@
"ZigbeeErrorNetworkUuidNotFound", "ZigbeeErrorNetworkUuidNotFound",
"ZigbeeErrorDurationOutOfRange", "ZigbeeErrorDurationOutOfRange",
"ZigbeeErrorNetworkOffline", "ZigbeeErrorNetworkOffline",
"ZigbeeErrorUnknownBackend" "ZigbeeErrorUnknownBackend",
"ZigbeeErrorNodeNotFound",
"ZigbeeErrorForbidden"
], ],
"ZigbeeNetworkState": [ "ZigbeeNetworkState": [
"ZigbeeNetworkStateOffline", "ZigbeeNetworkStateOffline",
@ -385,6 +387,17 @@
"ZigbeeNetworkStateUpdating", "ZigbeeNetworkStateUpdating",
"ZigbeeNetworkStateOnline", "ZigbeeNetworkStateOnline",
"ZigbeeNetworkStateError" "ZigbeeNetworkStateError"
],
"ZigbeeNodeState": [
"ZigbeeNodeStateUninitialized",
"ZigbeeNodeStateInitializing",
"ZigbeeNodeStateInitialized",
"ZigbeeNodeStateHandled"
],
"ZigbeeNodeType": [
"ZigbeeNodeTypeCoordinator",
"ZigbeeNodeTypeRouter",
"ZigbeeNodeTypeEndDevice"
] ]
}, },
"flags": { "flags": {
@ -2058,6 +2071,18 @@
] ]
} }
}, },
"Zigbee.GetNodes": {
"description": "Returns the list of ZigBee nodes from the network the given 'networkUuid' in the system.",
"params": {
"networkUuid": "Uuid"
},
"returns": {
"o:zigbeeNodes": [
"$ref:ZigbeeNode"
],
"zigbeeError": "$ref:ZigbeeError"
}
},
"Zigbee.RemoveNetwork": { "Zigbee.RemoveNetwork": {
"description": "Remove the ZigBee network with the given network uuid.", "description": "Remove the ZigBee network with the given network uuid.",
"params": { "params": {
@ -2067,6 +2092,16 @@
"zigbeeError": "$ref:ZigbeeError" "zigbeeError": "$ref:ZigbeeError"
} }
}, },
"Zigbee.RemoveNode": {
"description": "Remove a ZigBee node with the given 'ieeeAddress' from the network with the given 'networkUuid'. If there is a thing configured for this node, also the thing will be removed from the system. The coordinator node cannot be removed.",
"params": {
"ieeeAddress": "String",
"networkUuid": "Uuid"
},
"returns": {
"zigbeeError": "$ref:ZigbeeError"
}
},
"Zigbee.SetPermitJoin": { "Zigbee.SetPermitJoin": {
"description": "Allow or deny nodes to join the network with the given 'networkUuid' for a specific 'duration' in seconds. The duration value has to be between 0 and 255 seconds. The 'permitJoinDuration' property of ZigBee network object indicates how long permit has been enabled and the 'permitJoiningRemaining' indicates the rest of the time. Those values can be used to show a countdown or progressbar. This method can be recalled for resetting the timeout. If the duration is set to 0 seconds, joining will be disabled immediatly for the entire network. The 'shortAddress' is optional and defaults to the broadcast address 0xfffc for all routers in the network. If the short address matches the address of a router node in the network, only that specific router will be able to allow new nodes to join the network. A new node will join to the router with the best link quality index (LQI).", "description": "Allow or deny nodes to join the network with the given 'networkUuid' for a specific 'duration' in seconds. The duration value has to be between 0 and 255 seconds. The 'permitJoinDuration' property of ZigBee network object indicates how long permit has been enabled and the 'permitJoiningRemaining' indicates the rest of the time. Those values can be used to show a countdown or progressbar. This method can be recalled for resetting the timeout. If the duration is set to 0 seconds, joining will be disabled immediatly for the entire network. The 'shortAddress' is optional and defaults to the broadcast address 0xfffc for all routers in the network. If the short address matches the address of a router node in the network, only that specific router will be able to allow new nodes to join the network. A new node will join to the router with the best link quality index (LQI).",
"params": { "params": {
@ -2534,6 +2569,27 @@
"params": { "params": {
"networkUuid": "Uuid" "networkUuid": "Uuid"
} }
},
"Zigbee.NodeAdded": {
"description": "Emitted whenever a new ZigBee node has joined the network with the given 'networkUuid'.",
"params": {
"networkUuid": "Uuid",
"zigbeeNode": "$ref:ZigbeeNode"
}
},
"Zigbee.NodeChanged": {
"description": "Emitted whenever a ZigBee node has changed.",
"params": {
"networkUuid": "Uuid",
"zigbeeNode": "$ref:ZigbeeNode"
}
},
"Zigbee.NodeRemoved": {
"description": "Emitted whenever a ZigBee node has removed from the network with the given 'networkUuid'.",
"params": {
"networkUuid": "Uuid",
"zigbeeNode": "$ref:ZigbeeNode"
}
} }
}, },
"types": { "types": {
@ -3043,6 +3099,20 @@
"permitJoiningEnabled": "Bool", "permitJoiningEnabled": "Bool",
"permitJoiningRemaining": "Uint", "permitJoiningRemaining": "Uint",
"serialPort": "String" "serialPort": "String"
},
"ZigbeeNode": {
"ieeeAddress": "String",
"lastSeen": "Uint",
"lqi": "Uint",
"manufacturer": "String",
"model": "String",
"networkAddress": "Uint",
"networkUuid": "Uuid",
"reachable": "Bool",
"receiverOnWhileIdle": "Bool",
"state": "$ref:ZigbeeNodeState",
"type": "$ref:ZigbeeNodeType",
"version": "String"
} }
} }
} }