diff --git a/libnymea-zigbee/libnymea-zigbee.pro b/libnymea-zigbee/libnymea-zigbee.pro
index 066acf3..99eec39 100644
--- a/libnymea-zigbee/libnymea-zigbee.pro
+++ b/libnymea-zigbee/libnymea-zigbee.pro
@@ -20,6 +20,7 @@ SOURCES += \
zcl/general/zigbeeclustergroups.cpp \
zcl/general/zigbeeclusteridentify.cpp \
zcl/general/zigbeeclusterlevelcontrol.cpp \
+ zcl/general/zigbeeclustermultistateinput.cpp \
zcl/general/zigbeeclusteronoff.cpp \
zcl/general/zigbeeclusterpowerconfiguration.cpp \
zcl/hvac/zigbeeclusterthermostat.cpp \
@@ -77,6 +78,7 @@ HEADERS += \
zcl/general/zigbeeclustergroups.h \
zcl/general/zigbeeclusteridentify.h \
zcl/general/zigbeeclusterlevelcontrol.h \
+ zcl/general/zigbeeclustermultistateinput.h \
zcl/general/zigbeeclusteronoff.h \
zcl/general/zigbeeclusterpowerconfiguration.h \
zcl/hvac/zigbeeclusterthermostat.h \
diff --git a/libnymea-zigbee/zcl/general/zigbeeclustermultistateinput.cpp b/libnymea-zigbee/zcl/general/zigbeeclustermultistateinput.cpp
new file mode 100644
index 0000000..2e79f31
--- /dev/null
+++ b/libnymea-zigbee/zcl/general/zigbeeclustermultistateinput.cpp
@@ -0,0 +1,41 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*
+* Copyright 2013 - 2020, nymea GmbH
+* Contact: contact@nymea.io
+*
+* This file is part of nymea-zigbee.
+* This project including source code and documentation is protected by copyright law, and
+* remains the property of nymea GmbH. All rights, including reproduction, publication,
+* editing and translation, are reserved. The use of this project is subject to the terms of a
+* license agreement to be concluded with nymea GmbH in accordance with the terms
+* of use of nymea GmbH, available under https://nymea.io/license
+*
+* GNU Lesser General Public License Usage
+* Alternatively, this project may be redistributed and/or modified under the terms of the GNU
+* Lesser General Public License as published by the Free Software Foundation; version 3.
+* this project is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* See the GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License along with this project.
+* If not, see .
+*
+* For any further details and any questions please contact us under contact@nymea.io
+* or see our FAQ/Licensing Information on https://nymea.io/license/faq
+*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "zigbeeclustermultistateinput.h"
+#include "loggingcategory.h"
+
+ZigbeeClusterMultistateInput::ZigbeeClusterMultistateInput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, ZigbeeCluster::Direction direction, QObject *parent) :
+ ZigbeeCluster(network, node, endpoint, ZigbeeClusterLibrary::ClusterIdMultistateInput, direction, parent)
+{
+
+}
+
+void ZigbeeClusterMultistateInput::setAttribute(const ZigbeeClusterAttribute &attribute)
+{
+ qCDebug(dcZigbeeCluster()) << "Update attribute" << m_node << m_endpoint << this << static_cast(attribute.id()) << attribute.dataType();
+ updateOrAddAttribute(attribute);
+}
diff --git a/libnymea-zigbee/zcl/general/zigbeeclustermultistateinput.h b/libnymea-zigbee/zcl/general/zigbeeclustermultistateinput.h
new file mode 100644
index 0000000..fdcbaa5
--- /dev/null
+++ b/libnymea-zigbee/zcl/general/zigbeeclustermultistateinput.h
@@ -0,0 +1,64 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*
+* Copyright 2013 - 2020, nymea GmbH
+* Contact: contact@nymea.io
+*
+* This file is part of nymea-zigbee.
+* This project including source code and documentation is protected by copyright law, and
+* remains the property of nymea GmbH. All rights, including reproduction, publication,
+* editing and translation, are reserved. The use of this project is subject to the terms of a
+* license agreement to be concluded with nymea GmbH in accordance with the terms
+* of use of nymea GmbH, available under https://nymea.io/license
+*
+* GNU Lesser General Public License Usage
+* Alternatively, this project may be redistributed and/or modified under the terms of the GNU
+* Lesser General Public License as published by the Free Software Foundation; version 3.
+* this project is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* See the GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License along with this project.
+* If not, see .
+*
+* For any further details and any questions please contact us under contact@nymea.io
+* or see our FAQ/Licensing Information on https://nymea.io/license/faq
+*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef ZIGBEECLUSTERMULTISTATEINPUT_H
+#define ZIGBEECLUSTERMULTISTATEINPUT_H
+
+#include
+
+#include "zcl/zigbeecluster.h"
+
+class ZigbeeClusterMultistateInput : public ZigbeeCluster
+{
+ Q_OBJECT
+public:
+
+ friend class ZigbeeNode;
+ friend class ZigbeeNetwork;
+
+ enum Attribute {
+ AttributeDescription = 0x001C,
+ AttributeOutOfService = 0x0051,
+ AttributePresentValue = 0x0055,
+ AttributePriorityArray = 0x0057,
+ AttributeReliability = 0x0067,
+ AttributeRelinquishDefault = 0x0068,
+ AttributeStatusFlags = 0x006F,
+ AttributeEngineeringUnits = 0x0075,
+ AttributeApplicationType = 0x0100
+ };
+ Q_ENUM(Attribute)
+
+ explicit ZigbeeClusterMultistateInput(ZigbeeNetwork *network, ZigbeeNode *node, ZigbeeNodeEndpoint *endpoint, Direction direction, QObject *parent = nullptr);
+
+private:
+ void setAttribute(const ZigbeeClusterAttribute &attribute) override;
+
+
+};
+
+#endif // ZIGBEECLUSTERMULTISTATEINPUT_H
diff --git a/libnymea-zigbee/zcl/zigbeeclusterlibrary.h b/libnymea-zigbee/zcl/zigbeeclusterlibrary.h
index cd8543e..59a5851 100644
--- a/libnymea-zigbee/zcl/zigbeeclusterlibrary.h
+++ b/libnymea-zigbee/zcl/zigbeeclusterlibrary.h
@@ -120,15 +120,15 @@ public:
ClusterIdAlarms = 0x0009,
ClusterIdTime = 0x000A,
ClusterIdRssiLocation = 0x000B,
- ClusterIdAnalogInputBasic = 0x000C,
- ClusterIdAnalogOutputBasic = 0x000D,
- ClusterIdValueBasic = 0x000E,
- ClusterIdBinaryInputBasic = 0x000F,
- ClusterIdBinaryOutputBasic = 0x0010,
- ClusterIdBinaryValueBasic = 0x0011,
- ClusterIdMultiStateInputBasic = 0x0012,
- ClusterIdMultiStateOutputBasic = 0x0013,
- ClusterIdMultiStateValueBasic = 0x0014,
+ ClusterIdAnalogInput = 0x000C,
+ ClusterIdAnalogOutput = 0x000D,
+ ClusterIdAnalogValue = 0x000E,
+ ClusterIdBinaryInput = 0x000F,
+ ClusterIdBinaryOutput = 0x0010,
+ ClusterIdBinaryValue = 0x0011,
+ ClusterIdMultistateInput = 0x0012,
+ ClusterIdMultistateOutput = 0x0013,
+ ClusterIdMultistateValue = 0x0014,
ClusterIdCommissoning = 0x0015,
// Over the air uppgrade (OTA)
diff --git a/libnymea-zigbee/zigbeenetworkdatabase.cpp b/libnymea-zigbee/zigbeenetworkdatabase.cpp
index 6e63e7f..56fbfe8 100644
--- a/libnymea-zigbee/zigbeenetworkdatabase.cpp
+++ b/libnymea-zigbee/zigbeenetworkdatabase.cpp
@@ -167,10 +167,7 @@ QList ZigbeeNetworkDatabase::loadNodes()
}
node->m_endpoints.append(endpoint);
-
- // Connect after initialization for out of spec nodes
- connect(endpoint, &ZigbeeNodeEndpoint::inputClusterAdded, node, &ZigbeeNode::clusterAdded);
- connect(endpoint, &ZigbeeNodeEndpoint::outputClusterAdded, node, &ZigbeeNode::clusterAdded);
+ node->setupEndpointInternal(endpoint);
}
nodes.append(node);
}
diff --git a/libnymea-zigbee/zigbeenode.cpp b/libnymea-zigbee/zigbeenode.cpp
index 6fca8ef..4c55d11 100644
--- a/libnymea-zigbee/zigbeenode.cpp
+++ b/libnymea-zigbee/zigbeenode.cpp
@@ -427,9 +427,7 @@ void ZigbeeNode::initEndpoint(quint8 endpointId)
m_uninitializedEndpoints.removeAll(endpointId);
endpoint->m_initialized = true;
- // Connect after initialization for out of spec nodes
- connect(endpoint, &ZigbeeNodeEndpoint::inputClusterAdded, this, &ZigbeeNode::clusterAdded);
- connect(endpoint, &ZigbeeNodeEndpoint::outputClusterAdded, this, &ZigbeeNode::clusterAdded);
+ setupEndpointInternal(endpoint);
if (m_uninitializedEndpoints.isEmpty()) {
// Note: if we are initializing the coordinator, we can stop here
@@ -472,6 +470,16 @@ void ZigbeeNode::removeNextBinding(ZigbeeReply *reply)
});
}
+void ZigbeeNode::setupEndpointInternal(ZigbeeNodeEndpoint *endpoint)
+{
+ // Connect after initialization for out of spec nodes
+ connect(endpoint, &ZigbeeNodeEndpoint::inputClusterAdded, this, &ZigbeeNode::clusterAdded);
+ connect(endpoint, &ZigbeeNodeEndpoint::outputClusterAdded, this, &ZigbeeNode::clusterAdded);
+ connect(endpoint, &ZigbeeNodeEndpoint::clusterAttributeChanged, this, [this, endpoint](ZigbeeCluster *cluster, const ZigbeeClusterAttribute &attribute){
+ emit endpointClusterAttributeChanged(endpoint, cluster, attribute);
+ });
+}
+
void ZigbeeNode::initBasicCluster()
{
// Get the first endpoint which implements the basic cluster
diff --git a/libnymea-zigbee/zigbeenode.h b/libnymea-zigbee/zigbeenode.h
index 218ae25..1feb79a 100644
--- a/libnymea-zigbee/zigbeenode.h
+++ b/libnymea-zigbee/zigbeenode.h
@@ -126,6 +126,8 @@ private:
void removeNextBinding(ZigbeeReply *reply);
+ void setupEndpointInternal(ZigbeeNodeEndpoint *endpoint);
+
// For convenience and having base information about the first endpoint
void initBasicCluster();
void readManufacturerName(ZigbeeClusterBasic *basicCluster);
@@ -142,7 +144,7 @@ signals:
void reachableChanged(bool reachable);
void bindingTableRecordsChanged();
void clusterAdded(ZigbeeCluster *cluster);
- void clusterAttributeChanged(ZigbeeCluster *cluster, const ZigbeeClusterAttribute &attribute);
+ void endpointClusterAttributeChanged(ZigbeeNodeEndpoint *endpoint, ZigbeeCluster *cluster, const ZigbeeClusterAttribute &attribute);
public slots:
void handleZigbeeClusterLibraryIndication(const Zigbee::ApsdeDataIndication &indication);
diff --git a/libnymea-zigbee/zigbeenodeendpoint.cpp b/libnymea-zigbee/zigbeenodeendpoint.cpp
index 32315f0..b04ae7d 100644
--- a/libnymea-zigbee/zigbeenodeendpoint.cpp
+++ b/libnymea-zigbee/zigbeenodeendpoint.cpp
@@ -177,6 +177,8 @@ ZigbeeCluster *ZigbeeNodeEndpoint::createCluster(ZigbeeClusterLibrary::ClusterId
return new ZigbeeClusterLevelControl(m_network, m_node, this, direction, this);
case ZigbeeClusterLibrary::ClusterIdGroups:
return new ZigbeeClusterGroups(m_network, m_node, this, direction, this);
+ case ZigbeeClusterLibrary::ClusterIdMultistateInput:
+ return new ZigbeeClusterMultistateInput(m_network, m_node, this, direction, this);
// Measurement
case ZigbeeClusterLibrary::ClusterIdIlluminanceMeasurement:
diff --git a/libnymea-zigbee/zigbeenodeendpoint.h b/libnymea-zigbee/zigbeenodeendpoint.h
index 73d1a20..1f4f2c1 100644
--- a/libnymea-zigbee/zigbeenodeendpoint.h
+++ b/libnymea-zigbee/zigbeenodeendpoint.h
@@ -43,6 +43,7 @@
#include "zcl/general/zigbeeclusterlevelcontrol.h"
#include "zcl/general/zigbeeclusterpowerconfiguration.h"
#include "zcl/general/zigbeeclustergroups.h"
+#include "zcl/general/zigbeeclustermultistateinput.h"
#include "zcl/closures/zigbeeclusterdoorlock.h"