diff --git a/libguh/plugin/deviceplugin.cpp b/libguh/plugin/deviceplugin.cpp index 2063f729..6076c62a 100644 --- a/libguh/plugin/deviceplugin.cpp +++ b/libguh/plugin/deviceplugin.cpp @@ -163,6 +163,7 @@ QList DevicePlugin::supportedDevices() const deviceClass.setCreateMethods(createMethods); deviceClass.setDiscoveryParamTypes(parseParamTypes(jo.value("discoveryParamTypes").toArray())); + qDebug() << "loaded deviceClass" << deviceClass.discoveryParamTypes(); QString setupMethod = jo.value("setupMethod").toString(); if (setupMethod == "pushButton") { @@ -293,6 +294,11 @@ QList DevicePlugin::parseParamTypes(const QJsonArray &array) const foreach (const QJsonValue ¶mTypesJson, array) { QJsonObject pt = paramTypesJson.toObject(); QVariant::Type t = QVariant::nameToType(pt.value("type").toString().toLatin1().data()); + Q_ASSERT_X(t != QVariant::Invalid, + pluginName().toLatin1().data(), + QString("Invalid type %1 for param %2 in json file.") + .arg(pt.value("type").toString()) + .arg(pt.value("name").toString()).toLatin1().data()); ParamType paramType(pt.value("name").toString(), t, pt.value("defaultValue").toVariant()); QVariantList allowedValues; foreach (const QJsonValue &allowedTypesJson, pt.value("allowedValues").toArray()) { diff --git a/plugins/deviceplugins/lircd/devicepluginlircd.json b/plugins/deviceplugins/lircd/devicepluginlircd.json index 0f75dc98..976ab3ae 100644 --- a/plugins/deviceplugins/lircd/devicepluginlircd.json +++ b/plugins/deviceplugins/lircd/devicepluginlircd.json @@ -23,7 +23,7 @@ "paramTypes": [ { "name": "button", - "type": "string" + "type": "QString" }, { "name": "repeat", diff --git a/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.json b/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.json index aac6f81d..cdc8e1eb 100644 --- a/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.json +++ b/plugins/deviceplugins/openweathermap/devicepluginopenweathermap.json @@ -13,21 +13,21 @@ "discoveryParamTypes": [ { "name": "location", - "type": "string" + "type": "QString" } ], "paramTypes": [ { "name": "location", - "type": "string" + "type": "QString" }, { "name": "country", - "type": "string" + "type": "QString" }, { "name": "id", - "type": "string" + "type": "QString" } ], "actionTypes": [