diff --git a/libnymea-core/cloud/cloudnotifications.cpp b/libnymea-core/cloud/cloudnotifications.cpp index 50523208..97f7b8e6 100644 --- a/libnymea-core/cloud/cloudnotifications.cpp +++ b/libnymea-core/cloud/cloudnotifications.cpp @@ -109,7 +109,6 @@ CloudNotifications::CloudNotifications(QObject *parent): connectedState.insert("name", "connected"); connectedState.insert("displayName", tr("connected")); connectedState.insert("type", "bool"); - connectedState.insert("displayNameEvent", tr("Connected changed")); connectedState.insert("defaultValue", false); QVariantList stateTypes; diff --git a/libnymea/integrations/pluginmetadata.cpp b/libnymea/integrations/pluginmetadata.cpp index 2adf2e87..c34eca98 100644 --- a/libnymea/integrations/pluginmetadata.cpp +++ b/libnymea/integrations/pluginmetadata.cpp @@ -333,10 +333,11 @@ void PluginMetadata::parse(const QJsonObject &jsonObject) QJsonObject st = stateTypesJson.toObject(); bool writableState = false; + // TODO: DEPRECATED 1.2: Remove displayNameEvent eventually (requires updating all plugins) QStringList stateTypeProperties = {"id", "name", "displayName", "displayNameEvent", "type", "defaultValue", "cached", "unit", "minValue", "maxValue", "possibleValues", "writable", "displayNameAction", "ioType", "suggestLogging", "filter"}; - QStringList mandatoryStateTypeProperties = {"id", "name", "displayName", "displayNameEvent", "type", "defaultValue"}; + QStringList mandatoryStateTypeProperties = {"id", "name", "displayName", "type", "defaultValue"}; QPair verificationResult = verifyFields(stateTypeProperties, mandatoryStateTypeProperties, st); // Check mandatory fields @@ -355,6 +356,11 @@ void PluginMetadata::parse(const QJsonObject &jsonObject) m_validationErrors.append("Thing class \"" + thingClass.name() + "\" state type \"" + stateTypeName + "\" has unknown properties \"" + verificationResult.second.join("\", \"") + "\""); hasError = true; } + // Print warning on deprecated fields + if (st.contains("displayNameEvent")) { + m_validationErrors.contains("Thing class \"" + thingClass.name() + "\" state type \"" + stateTypeName + "\" contains deprecated displayNameEvent property"); + // Not a real error, not setting hasError. + } // If this is a writable stateType, there must be also the displayNameAction property if (st.contains("writable") && st.value("writable").toBool()) { diff --git a/plugins/mock/integrationpluginmock.json b/plugins/mock/integrationpluginmock.json index 33253ae3..c10de548 100644 --- a/plugins/mock/integrationpluginmock.json +++ b/plugins/mock/integrationpluginmock.json @@ -94,7 +94,6 @@ "id": "80baec19-54de-4948-ac46-31eabfaceb83", "name": "int", "displayName": "Dummy int state", - "displayNameEvent": "Dummy int state changed", "defaultValue": 10, "type": "int", "suggestLogging": true @@ -103,7 +102,6 @@ "id": "5aa479bd-537a-4716-9852-52f6eec58722", "name": "intWithLimits", "displayName": "Dummy int state with limits", - "displayNameEvent": "Dummy int state with limits changed", "displayNameAction": "Set dummy int state with limits", "defaultValue": 10, "type": "int", @@ -116,7 +114,6 @@ "id": "9dd6a97c-dfd1-43dc-acbd-367932742310", "name": "bool", "displayName": "Dummy bool state", - "displayNameEvent": "Dummy bool state changed", "defaultValue": false, "type": "bool", "cached": false @@ -125,7 +122,6 @@ "id": "7cac53ee-7048-4dc9-b000-7b585390f34c", "name": "double", "displayName": "Dummy double state", - "displayNameEvent": "Dummy double state changed", "type": "double", "minValue": 0, "maxValue": 100, @@ -135,7 +131,6 @@ "id": "6c8ab9a6-0164-4795-b829-f4394fe4edc4", "name": "batteryLevel", "displayName": "Battery level", - "displayNameEvent": "Battery level", "displayNameAction": "Set battery level", "type": "int", "unit": "Percentage", @@ -148,7 +143,6 @@ "id": "580bc611-1a55-41f3-996f-8d3ccf543db3", "name": "batteryCritical", "displayName": "battery level critical", - "displayNameEvent": "battery level critical", "type": "bool", "defaultValue": false }, @@ -156,7 +150,6 @@ "id": "064aed0d-da4c-49d4-b236-60f97e98ff84", "name": "power", "displayName": "powered", - "displayNameEvent": "powered changed", "displayNameAction": "set power", "type": "bool", "defaultValue": false, @@ -166,7 +159,6 @@ "id": "9860d105-2bd9-4651-9bc9-13ff4b9039a7", "name": "connected", "displayName": "Connected", - "displayNameEvent": "Connected changed", "type": "bool", "defaultValue": true }, @@ -174,7 +166,6 @@ "id": "2a0213bf-4af3-4384-904e-3376348a597e", "name": "signalStrength", "displayName": "Signal strength", - "displayNameEvent": "Signal strength changed", "displayNameAction": "Set signal strength", "type": "uint", "unit": "Percentage", @@ -188,7 +179,6 @@ "id": "ebc41327-53d5-40c2-8e7b-1164a8ff359e", "name": "updateStatus", "displayName": "Update status", - "displayNameEvent": "Update status changed", "displayNameAction": "Set update status", "type": "QString", "possibleValues": ["idle", "available", "updating"], @@ -199,7 +189,6 @@ "id": "9f2e1e5d-3f1f-4794-aca3-4e05b7a48842", "name": "currentVersion", "displayName": "Firmware version", - "displayNameEvent": "Firmware version changed", "type": "QString", "defaultValue": "" }, @@ -207,7 +196,6 @@ "id": "060d7947-2b70-4a2b-b33b-a3577f71faeb", "name": "availableVersion", "displayName": "Available firmware version", - "displayNameEvent": "Available firmware version changed", "type": "QString", "defaultValue": "" } @@ -361,7 +349,6 @@ "id": "74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c", "name": "int", "displayName": "Dummy int state", - "displayNameEvent": "Dummy int state changed", "defaultValue": 10, "type": "int", "suggestLogging": true @@ -370,7 +357,6 @@ "id": "978b0ba5-d008-41bd-b63d-a3bd23cb6469", "name": "boolValue", "displayName": "Dummy bool state", - "displayNameEvent": "Dummy bool state changed", "defaultValue": false, "type": "bool", "cached": false @@ -462,7 +448,6 @@ "id": "20dc7c22-c50e-42db-837c-2bbced939f8e", "name": "color", "displayName": "color", - "displayNameEvent": "color changed", "displayNameAction": "Set color", "type": "QColor", "defaultValue": "#000000", @@ -472,7 +457,6 @@ "id": "72981c04-267a-4ba0-a59e-9921d2f3af9c", "name": "percentage", "displayName": "percentage", - "displayNameEvent": "percentage changed", "displayNameAction": "Set percentage", "type": "int", "unit": "Percentage", @@ -485,7 +469,6 @@ "id": "05f63f9c-f61e-4dcf-ad55-3f13fde2765b", "name": "allowedValues", "displayName": "allowed values", - "displayNameEvent": "allowed values changed", "displayNameAction": "Set allowed values", "type": "QString", "defaultValue": "String value 1", @@ -501,7 +484,6 @@ "id": "53cd7c55-49b7-441b-b970-9048f20f0e2c", "name": "double", "displayName": "double value", - "displayNameEvent": "double value changed", "displayNameAction": "Set double value", "type": "double", "defaultValue": 0.0, @@ -513,7 +495,6 @@ "id": "e680f7a4-b39e-46da-be41-fa3170fe3768", "name": "bool", "displayName": "bool value", - "displayNameEvent": "bool value changed", "displayNameAction": "Set bool value", "type": "bool", "defaultValue": false, @@ -561,7 +542,6 @@ "id": "3e161294-8a0d-4384-9676-6959e08cc2fa", "name": "color", "displayName": "color", - "displayNameEvent": "color changed", "displayNameAction": "Set color", "type": "QColor", "defaultValue": "#000000", @@ -571,7 +551,6 @@ "id": "527f0687-0b28-4c26-852c-25b8f83e4797", "name": "percentage", "displayName": "percentage", - "displayNameEvent": "percentage changed", "displayNameAction": "Set percentage", "type": "int", "unit": "Percentage", @@ -584,7 +563,6 @@ "id": "b463c5ae-4d55-402f-8480-a5cdb485c143", "name": "allowedValues", "displayName": "allowed values", - "displayNameEvent": "allowed values changed", "displayNameAction": "Set allowed values", "type": "QString", "defaultValue": "String value 1", @@ -600,7 +578,6 @@ "id": "17635624-7c19-4bae-8429-2f7aa5d2f843", "name": "double", "displayName": "double value", - "displayNameEvent": "double value changed", "displayNameAction": "Set double value", "type": "double", "defaultValue": 0.0, @@ -612,7 +589,6 @@ "id": "7ffe514f-7999-4998-8350-0e73e222a8c4", "name": "bool", "displayName": "bool value", - "displayNameEvent": "bool value changed", "displayNameAction": "Set bool value", "type": "bool", "defaultValue": false, @@ -639,7 +615,6 @@ "id": "d24ede5f-4064-4898-bb84-cfb533b1fbc0", "name": "boolValue", "displayName": "bool value", - "displayNameEvent": "bool value changed", "displayNameAction": "Set bool value", "type": "bool", "defaultValue": false, @@ -665,7 +640,6 @@ "id": "80ba1449-b485-47d4-a067-6bf306e2a568", "name": "boolValue", "displayName": "bool value", - "displayNameEvent": "bool value changed", "displayNameAction": "Set bool value", "type": "bool", "defaultValue": false, @@ -764,7 +738,6 @@ "id": "3bad3a09-5826-4ed7-a832-10e3e2ee2a7d", "name": "bool", "displayName": "Bool", - "displayNameEvent": "Bool changed", "type": "bool", "defaultValue": true }, @@ -772,7 +745,6 @@ "id": "a7c11774-f31f-4d64-99d1-e0ae5fb35a5c", "name": "writableBool", "displayName": "Writable Bool", - "displayNameEvent": "Writable Bool changed", "displayNameAction": "Set Writable Bool", "type": "bool", "defaultValue": false, @@ -782,7 +754,6 @@ "id": "d0fc56ae-5791-4e91-b76c-dadfbc7e7dbb", "name": "int", "displayName": "Int", - "displayNameEvent": "Int changed", "type": "int", "defaultValue": -5 }, @@ -790,7 +761,6 @@ "id": "857a8422-983c-47d6-a15f-d8450b3162f7", "name": "writableInt", "displayName": "Writable Int", - "displayNameEvent": "Writable Int changed", "displayNameAction": "Set Writable Int", "type": "int", "defaultValue": -8, @@ -801,7 +771,6 @@ "id": "86a107bc-510a-4d38-bfeb-0a9c2b6d8d87", "name": "writableIntMinMax", "displayName": "Writable Int (min/max)", - "displayNameEvent": "Writable Int (min/max) changed", "displayNameAction": "Set Writable Int (min/max)", "type": "int", "defaultValue": 45, @@ -813,7 +782,6 @@ "id": "19e74fcc-bfd5-491f-8eb6-af128e8f1162", "name": "uint", "displayName": "UInt", - "displayNameEvent": "UInt changed", "type": "uint", "defaultValue": 13 }, @@ -821,7 +789,6 @@ "id": "563e9c4c-5198-400a-9f6c-358f4752af58", "name": "writableUInt", "displayName": "Writable UInt", - "displayNameEvent": "Writable UInt changed", "displayNameAction": "Set Writable UInt", "type": "uint", "defaultValue": 16, @@ -832,7 +799,6 @@ "id": "79238998-eaab-4d71-b406-5d78f1749751", "name": "writableUIntMinMax", "displayName": "Writable UInt (min/max)", - "displayNameEvent": "Writable UInt (min/max) changed", "displayNameAction": "Set Writable UInt (min/max)", "type": "uint", "defaultValue": 45, @@ -845,7 +811,6 @@ "id": "f7d2063d-959e-46ac-8568-8b99722d3b22", "name": "double", "displayName": "Double", - "displayNameEvent": "Double changed", "type": "double", "defaultValue": 2.346422356544, "unit": "MicroSiemensPerCentimeter" @@ -854,7 +819,6 @@ "id": "8e2eb91b-d60b-4461-9a50-d7b8ad263170", "name": "writableDouble", "displayName": "Writable Double", - "displayNameEvent": "Writable Double changed", "displayNameAction": "Set Writable Double", "type": "double", "defaultValue": -8.8, @@ -865,7 +829,6 @@ "id": "00d3425e-1da6-4748-8906-4555ceefb136", "name": "writableDoubleMinMax", "displayName": "Writable Double (min/max)", - "displayNameEvent": "Writable Double (min/max) changed", "displayNameAction": "Set Writable Double (min/max)", "type": "double", "defaultValue": 12.4, @@ -878,7 +841,6 @@ "id": "27f69ca9-a321-40ff-bfee-4b0272a671b4", "name": "string", "displayName": "String", - "displayNameEvent": "String changed", "type": "QString", "defaultValue": "A string :)" }, @@ -886,7 +848,6 @@ "id": "ef511043-bd1a-4a5f-984c-222b7da43f38", "name": "writableString", "displayName": "Writable String", - "displayNameEvent": "Writable String changed", "displayNameAction": "Set Writable String", "type": "QString", "defaultValue": "Change me!", @@ -896,7 +857,6 @@ "id": "209d7afc-6fe9-4fe9-939b-e472ea0ad639", "name": "writableStringSelection", "displayName": "Writable String (selection)", - "displayNameEvent": "Writable String (selection) changed", "displayNameAction": "Set Writable String (selection)", "type": "QString", "defaultValue": "One", @@ -907,7 +867,6 @@ "id": "4507d5c6-b692-4bd6-87f2-00364bc0cb4d", "name": "color", "displayName": "Color", - "displayNameEvent": "Color changed", "type": "QColor", "defaultValue": "#FF0000" }, @@ -915,7 +874,6 @@ "id": "455f4f68-3cb0-4e8a-a707-62e4a2a8035c", "name": "writableColor", "displayName": "Writable Color", - "displayNameEvent": "Writable Color changed", "displayNameAction": "Set Writable Color", "type": "QColor", "defaultValue": "#0000FF", @@ -925,7 +883,6 @@ "id": "8250c71e-59bc-41ab-b576-99fcfc34e8d1", "name": "time", "displayName": "Time", - "displayNameEvent": "Time changed", "displayNameAction": "Set Time", "type": "QTime", "defaultValue": "03:04" @@ -934,7 +891,6 @@ "id": "d64c8b3f-ca7d-47f6-b271-867ffd80a4d4", "name": "writableTime", "displayName": "Writable Time", - "displayNameEvent": "Writable Time changed", "displayNameAction": "Set Writable Time", "type": "QTime", "defaultValue": "15:12", @@ -944,7 +900,6 @@ "id": "2c91b5ef-c2d1-4367-bc65-5a13abf69641", "name": "timestampInt", "displayName": "Timestamp (Int)", - "displayNameEvent": "Timestamp (Int) changed", "type": "int", "defaultValue": -349394745, "unit": "UnixTime" @@ -953,7 +908,6 @@ "id": "88b6746a-b009-4df6-8986-d7884ffd94b2", "name": "writableTimestampInt", "displayName": "Writable Timestamp (Int)", - "displayNameEvent": "Writable Timestamp (Int) changed", "displayNameAction": "Set Writable Timestamp (Int)", "type": "int", "defaultValue": -349394745, @@ -964,7 +918,6 @@ "id": "6c9a96e8-0d48-4f42-8967-848358fd7f79", "name": "timestampUInt", "displayName": "Timestamp (UInt)", - "displayNameEvent": "Timestamp (UInt) changed", "type": "uint", "defaultValue": 1549394745, "unit": "UnixTime" @@ -973,7 +926,6 @@ "id": "45d0069a-63ac-4265-8170-8152778608ee", "name": "writableTimestampUInt", "displayName": "Writable Timestamp (UInt)", - "displayNameEvent": "Writable Timestamp (UInt) changed", "displayNameAction": "Set Writable Timestamp (UInt)", "type": "uint", "defaultValue": 1549394745, @@ -1014,7 +966,6 @@ "id": "07165c12-4d53-45c0-8bf1-34618443b706", "name": "digitalInput1", "displayName": "Digital input 1", - "displayNameEvent": "Digital input 1 changed", "type": "bool", "defaultValue": false, "ioType": "digitalInput" @@ -1023,7 +974,6 @@ "id": "0a4362ba-a086-4540-84ba-107ef7b99ed8", "name": "digitalInput2", "displayName": "Digital input 2", - "displayNameEvent": "Digital input 2 changed", "type": "bool", "defaultValue": false, "ioType": "digitalInput" @@ -1032,7 +982,6 @@ "id": "d6fcdb52-f7c3-423b-b9f5-1e29f164c42e", "name": "digitalOutput1", "displayName": "Digital Output 1", - "displayNameEvent": "Digital Output 1 changed", "displayNameAction": "Set Digital Output 1", "type": "bool", "defaultValue": false, @@ -1043,7 +992,6 @@ "id": "35de8b68-0cf3-4850-a27d-cf9c4a26921f", "name": "digitalOutput2", "displayName": "Digital Output 2", - "displayNameEvent": "Digital Output 2 changed", "displayNameAction": "Set Digital Output 2", "type": "bool", "defaultValue": false, @@ -1054,7 +1002,6 @@ "id": "ac56977c-cbba-47c6-a827-5735d8b0aed6", "name": "analogInput1", "displayName": "Analog Input 1", - "displayNameEvent": "Analog Input 1 changed", "type": "double", "defaultValue": 0, "ioType": "analogInput", @@ -1067,7 +1014,6 @@ "id": "8e07e57e-ba4e-42df-81ee-5b72ed074532", "name": "analogInput2", "displayName": "Analog Input 2", - "displayNameEvent": "Analog Input 2 changed", "type": "double", "defaultValue": 0, "ioType": "analogInput", @@ -1078,7 +1024,6 @@ "id": "70cf053e-4abc-4d88-8e1e-2bd9a62256c7", "name": "analogOutput1", "displayName": "Analog Output 1", - "displayNameEvent": "Analog Output 1 changed", "displayNameAction": "Set Output Input 1", "type": "double", "defaultValue": 0, @@ -1091,7 +1036,6 @@ "id": "e40bcf7d-47b8-41fa-b213-3652a905b376", "name": "analogOutput2", "displayName": "Analog Output 2", - "displayNameEvent": "Analog Output 2 changed", "displayNameAction": "Set Output Input 2", "type": "double", "defaultValue": 0, @@ -1114,7 +1058,6 @@ "id": "d1917b3d-1530-4cf9-90f7-263ee88e714b", "name": "power", "displayName": "Power", - "displayNameEvent": "Power changed", "displayNameAction": "Set power", "type": "bool", "defaultValue": false, @@ -1153,7 +1096,6 @@ "id": "fd341f72-6d9a-4812-9f66-47197c48a935", "name": "input", "displayName": "Input", - "displayNameEvent": "Input changed", "displayNameAction": "Set input", "type": "double", "defaultValue": 0, @@ -1166,7 +1108,6 @@ "id": "db9cc518-1012-47e2-8212-6e616fed07a6", "name": "temperature", "displayName": "Temperature", - "displayNameEvent": "Temperature changed", "type": "double", "unit": "DegreeCelsius", "defaultValue": -20 diff --git a/plugins/pymock/integrationpluginpymock.json b/plugins/pymock/integrationpluginpymock.json index 6c94e7ae..3f064ce0 100644 --- a/plugins/pymock/integrationpluginpymock.json +++ b/plugins/pymock/integrationpluginpymock.json @@ -37,7 +37,6 @@ "id": "12c82472-56b0-4229-b324-4aaa6850320e", "name": "state1", "displayName": "State 1", - "displayNameEvent": "State 1 changed", "type": "bool", "defaultValue": false } @@ -79,7 +78,6 @@ "id": "24714828-93ec-41a7-875e-6a0b5b57d25c", "name": "state1", "displayName": "State 1", - "displayNameEvent": "State 1 changed", "displayNameAction": "Set state 1", "type": "int", "defaultValue": 0 @@ -157,7 +155,6 @@ "id": "99d0af17-9e8c-42bb-bece-a5d114f051d3", "name": "state1", "displayName": "State 1", - "displayNameEvent": "State 1 changed", "displayNameAction": "Set state 1", "type": "int", "defaultValue": 0