diff --git a/rest_node_base.cpp b/rest_node_base.cpp index eab3c108e6..d5cd0373f8 100644 --- a/rest_node_base.cpp +++ b/rest_node_base.cpp @@ -108,6 +108,12 @@ void RestNodeBase::setId(const QString &id) */ const QString &RestNodeBase::uniqueId() const { + const Resource *r = dynamic_cast(this); + const ResourceItem *item = r ? r->item(RAttrUniqueId) : 0; + if (item) + { + return item->toString(); + } return m_uid; } @@ -117,6 +123,12 @@ const QString &RestNodeBase::uniqueId() const */ void RestNodeBase::setUniqueId(const QString &uid) { + Resource *r = dynamic_cast(this); + ResourceItem *item = r ? r->addItem(DataTypeString, RAttrUniqueId) : 0; + if (item) + { + item->setValue(uid); + } m_uid = uid; } diff --git a/rest_sensors.cpp b/rest_sensors.cpp index 27d49a1b99..649306015e 100644 --- a/rest_sensors.cpp +++ b/rest_sensors.cpp @@ -1527,7 +1527,12 @@ bool DeRestPluginPrivate::sensorToMap(const Sensor *sensor, QVariantMap &map, bo { map["manufacturername"] = sensor->manufacturer(); } - map["uniqueid"] = sensor->uniqueId(); + + const ResourceItem *item = sensor->item(RAttrUniqueId); + if (item) + { + map["uniqueid"] = item->toString(); + } map["state"] = state; map["config"] = config;