Merge PR #125: Use the new nymea-plugininfocompiler for building

master
Jenkins 2019-07-22 12:17:14 +02:00
commit 1d694351ab
17 changed files with 199 additions and 158 deletions

View File

@ -63,7 +63,7 @@
],
"stateTypes": [
{
"id": "28d7e933-ff05-4f4c-95a0-482689543de5",
"id": "f52eb984-432c-43b6-88f1-15edb026725f",
"name": "running",
"displayName": "running",
"displayNameEvent": "running changed",
@ -73,12 +73,12 @@
],
"actionTypes": [
{
"id": "cf52b41d-3108-423c-8907-ca5b4d97cac5",
"id": "4af6068f-3118-442c-8e52-c1262cd318d8",
"name": "trigger",
"displayName": "Execute"
},
{
"id": "d21b1fed-1dd9-4c5a-a64e-0c6ba94059be",
"id": "e05c451b-4c89-45ba-9241-af926defdfbc",
"name": "kill",
"displayName": "Kill"
}

View File

@ -428,9 +428,9 @@ void DevicePluginDateTime::updateTimes()
return;
if (m_dusk.isValid()) {
m_todayDevice->setStateValue(todayDuskStateTypeId, m_dusk.toTime_t());
m_todayDevice->setStateValue(todayDuskTimeStateTypeId, m_dusk.toTime_t());
} else {
m_todayDevice->setStateValue(todayDuskStateTypeId, 0);
m_todayDevice->setStateValue(todayDuskTimeStateTypeId, 0);
}
if (m_sunrise.isValid() && m_sunset.isValid()) {
m_todayDevice->setStateValue(todaySunriseTimeStateTypeId, m_sunrise.toTime_t());
@ -442,14 +442,14 @@ void DevicePluginDateTime::updateTimes()
m_todayDevice->setStateValue(todayDaylightStateTypeId, false);
}
if (m_dusk.isValid()) {
m_todayDevice->setStateValue(todayNoonStateTypeId, m_noon.toTime_t());
m_todayDevice->setStateValue(todayNoonTimeStateTypeId, m_noon.toTime_t());
} else {
m_todayDevice->setStateValue(todayNoonStateTypeId, 0);
m_todayDevice->setStateValue(todayNoonTimeStateTypeId, 0);
}
if (m_dusk.isValid()) {
m_todayDevice->setStateValue(todayDawnStateTypeId, m_dawn.toTime_t());
m_todayDevice->setStateValue(todayDawnTimeStateTypeId, m_dawn.toTime_t());
} else {
m_todayDevice->setStateValue(todayDawnStateTypeId, 0);
m_todayDevice->setStateValue(todayDawnTimeStateTypeId, 0);
}
}

View File

@ -104,9 +104,9 @@
},
{
"id": "44a99419-fbcd-4d8e-9441-897848b8f77c",
"name": "dusk",
"displayName": "dusk",
"displayNameEvent": "dusk changed",
"name": "duskTime",
"displayName": "Dusk time",
"displayNameEvent": "Dusk time changed",
"unit": "UnixTime",
"type": "int",
"defaultValue": 0
@ -114,26 +114,26 @@
{
"id": "3a08824d-285b-412e-a515-9664b491a85c",
"name": "sunriseTime",
"displayName": "sunrise",
"displayNameEvent": "sunrise changed",
"displayName": "Sunrise time",
"displayNameEvent": "Sunrise time changed",
"unit": "UnixTime",
"type": "int",
"defaultValue": 0
},
{
"id": "d92be29a-929c-4240-91a0-30153850f838",
"name": "noon",
"displayName": "noon",
"displayNameEvent": "noon changed",
"name": "noonTime",
"displayName": "Noon time",
"displayNameEvent": "Noon time changed",
"unit": "UnixTime",
"type": "int",
"defaultValue": 0
},
{
"id": "a5779b11-0499-4a6d-a7bd-8143dcc546b4",
"name": "dawn",
"displayName": "dawn",
"displayNameEvent": "dawn changed",
"name": "dawnTime",
"displayName": "Dawn time",
"displayNameEvent": "Dawn time changed",
"unit": "UnixTime",
"type": "int",
"defaultValue": 0
@ -141,8 +141,8 @@
{
"id": "377f04a7-df58-42ad-a234-e9e23bdc2f85",
"name": "sunsetTime",
"displayName": "sunset",
"displayNameEvent": "sunset changed",
"displayName": "Sunset time",
"displayNameEvent": "Sunset time changed",
"unit": "UnixTime",
"type": "int",
"defaultValue": 0

5
debian/changelog vendored
View File

@ -1,3 +1,8 @@
nymea-plugins (0.15.0) UNRELEASED; urgency=medium
-- Michael Zanetti <michael.zanetti@guh.io> Wed, 26 Jun 2019 21:44:29 +0200
nymea-plugins (0.12.3) xenial; urgency=medium
[ Michael Zanetti ]

2
debian/control vendored
View File

@ -7,6 +7,8 @@ Build-depends: libboblight-dev,
libnymea1-dev,
libnymea-mqtt-dev,
libqt5serialport5-dev,
libqt5websockets5-dev,
nymea-dev-tools:native,
pkg-config,
python:any,
qtbase5-dev,

View File

@ -73,14 +73,14 @@
"interfaces": ["connectable"],
"paramTypes": [
{
"id": "b50b3682-fb2e-4185-b7aa-31741648d9bb",
"id": "b5dd0e68-5af4-41f5-bf78-64af77f752cb",
"name": "thing",
"displayName": "Thing",
"type" : "QString",
"inputType": "TextLine"
},
{
"id": "892b7323-ee85-4520-9160-f206f11b344e",
"id": "701fa3d5-d858-46cc-838d-2536c0c00612",
"name": "key",
"displayName": "Key",
"type" : "QString",
@ -88,7 +88,7 @@
"inputType": "TextLine"
},
{
"id": "f2b2c3ae-a915-4dd9-a9dd-9545d9dd3d4e",
"id": "5359f463-5d41-4a85-b96c-29fb2a9ecc3a",
"name": "contentName",
"displayName": "Content name",
"type": "QString",
@ -97,7 +97,7 @@
],
"stateTypes": [
{
"id": "4d1790bf-28c6-4c1f-8892-ba1a0ef140f5",
"id": "1e34d724-2be9-4866-abe1-93715cc1d73f",
"name": "connected",
"displayName": "connected",
"displayNameEvent": "connected changed",

View File

@ -481,6 +481,7 @@ void DevicePluginEQ3::radiatorThermostatDataUpdated()
foreach (Device *device, myDevices().filterByDeviceClassId(radiatorThermostateDeviceClassId)){
if(device->paramValue(radiatorThermostateDeviceSerialParamTypeId).toString() == radiatorThermostat->serialNumber()){
device->setStateValue(radiatorThermostateComfortTempStateTypeId, radiatorThermostat->comfortTemp());
device->setStateValue(radiatorThermostateEcoTempStateTypeId, radiatorThermostat->ecoTemp());
device->setStateValue(radiatorThermostateMaxSetpointTempStateTypeId, radiatorThermostat->maxSetPointTemp());
device->setStateValue(radiatorThermostateMinSetpointTempStateTypeId, radiatorThermostat->minSetPointTemp());
device->setStateValue(radiatorThermostateErrorOccurredStateTypeId, radiatorThermostat->errorOccurred());

View File

@ -69,7 +69,7 @@
"createMethods": ["auto"],
"paramTypes": [
{
"id": "67dc1a45-7369-422a-b677-881271f29d6c",
"id": "20f0c135-6f7a-46e5-b766-d0f41af08041",
"name": "serial",
"displayName": "serial number",
"type": "QString",
@ -275,38 +275,38 @@
"createMethods": ["auto"],
"paramTypes": [
{
"id": "67dc1a45-7369-422a-b677-881271f29d6c",
"id": "846b06c2-44b9-4507-93db-1a34c9343078",
"name": "serial",
"displayName": "serial number",
"type": "QString",
"inputType": "TextLine"
},
{
"id": "8d32b228-8618-483f-bcc3-2d62868d6912",
"id": "e098f95d-cbf8-4d41-bb03-0691a932f8c2",
"name": "name",
"displayName": "name",
"type": "QString"
},
{
"id": "801be701-ea53-4cb2-a933-823f330e7837",
"id": "809730b8-06fe-42f0-9775-7d8ae1a1620b",
"name": "parent",
"displayName": "parent cube",
"type": "QString"
},
{
"id": "6ba358c1-0c31-4ea4-93fd-544f030582a7",
"id": "d74e8fb8-71cc-4bb5-ac0a-04a100458bdb",
"name": "rf",
"displayName": "rf address",
"type": "QString"
},
{
"id": "e3bb28dc-5311-4325-805a-e1e3a1495016",
"id": "c503088e-0ec4-45d2-974e-136a70ff7e97",
"name": "room",
"displayName": "room id",
"type": "int"
},
{
"id": "14ea2e10-4545-47ff-8955-8172913f1039",
"id": "1a96b197-347b-48be-b997-4a9c8b731a51",
"name": "roomName",
"displayName": "room name",
"type": "QString"
@ -314,24 +314,24 @@
],
"actionTypes": [
{
"id": "162b4b3d-9923-4f2c-a755-b50c8a06a6f0",
"id": "8f93e550-df94-46f4-81fc-aea595fc5cad",
"name": "setAutoMode",
"displayName": "set auto mode"
},
{
"id": "8e604437-9f5b-4c17-b5b0-e2db6007af5b",
"id": "739bab00-69ed-49a2-876c-940cd917b6fe",
"name": "setManualMode",
"displayName": "set manual mode"
},
{
"id": "27a981e8-ec23-4ba8-921e-33b911a7dd89",
"id": "9d9e8936-ff08-4e7c-85a4-ecadbf324146",
"name": "setEcoMode",
"displayName": "set eco mode"
}
],
"stateTypes": [
{
"id": "850380ee-a787-43e7-adb8-768a21a6e64d",
"id": "7144cc38-bee5-443e-b56c-cb3c7742adf2",
"name": "comfortTemp",
"displayName": "comfort temperature",
"displayNameEvent": "comfort temperature changed",
@ -340,8 +340,8 @@
"defaultValue": 0
},
{
"id": "24dfd20d-bc8d-48e4-8162-b20ae0465c41",
"name": "comfortTemp",
"id": "9e0cf843-39e8-4657-a803-794a6c01a357",
"name": "ecoTemp",
"displayName": "eco temperature",
"displayNameEvent": "eco temperature changed",
"unit": "DegreeCelsius",
@ -349,7 +349,7 @@
"defaultValue": 0
},
{
"id": "a8536ddf-a6e4-41c2-89c1-e7102608f5f6",
"id": "b427a875-aa4b-4aa8-9beb-4fe6af73788b",
"name": "maxSetpointTemp",
"displayName": "max setpoint",
"displayNameEvent": "max setpoint changed",
@ -358,7 +358,7 @@
"defaultValue": 0
},
{
"id": "ceb0ad05-37ad-4b79-a4d9-540c34a7e3e4",
"id": "d935ff02-09a7-47b0-adf0-ae1ba11fbd1d",
"name": "minSetpointTemp",
"displayName": "min setpoint",
"displayNameEvent": "min setpoint changed",
@ -367,7 +367,7 @@
"defaultValue": 0
},
{
"id": "9880247b-cf9a-453c-b0c3-d910eba8a253",
"id": "ea83c3a4-d874-4c15-8749-fd210773e3c8",
"name": "errorOccurred",
"displayName": "error occured",
"displayNameEvent": "error occured changed",
@ -375,7 +375,7 @@
"defaultValue": false
},
{
"id": "a9e29f03-063e-4686-8aac-2f6d8f8a4937",
"id": "48ab1d1e-f5c9-4c32-8898-0e4f1bee6a13",
"name": "initialized",
"displayName": "initialized",
"displayNameEvent": "initialized changed",
@ -383,7 +383,7 @@
"defaultValue": false
},
{
"id": "53b89f32-8894-4290-92a0-6a470c6b69ab",
"id": "2b1beca3-5053-41f5-a826-2a7c1d59da20",
"name": "batteryLow",
"displayName": "battery low",
"displayNameEvent": "battery low changed",
@ -391,7 +391,7 @@
"defaultValue": false
},
{
"id": "aff38be8-7ea6-4fd8-b0fa-e987ab05c719",
"id": "bbc03a0b-f4dc-48dc-8924-79028f0357a2",
"name": "linkStatusOk",
"displayName": "link status ok",
"displayNameEvent": "link status changed",
@ -399,7 +399,7 @@
"defaultValue": false
},
{
"id": "979df197-09a1-46f9-9217-9d323b1062bd",
"id": "a4a94f4e-28b5-4b60-90d2-1476f0084326",
"name": "panelLocked",
"displayName": "panel locked",
"displayNameEvent": "pannel locked changed",
@ -407,7 +407,7 @@
"defaultValue": false
},
{
"id": "1d6bd962-5c31-47ad-80a4-dda87bff98f5",
"id": "85c34911-e16c-488d-b6cc-08b80b12b5d2",
"name": "gatewayKnown",
"displayName": "gateway known",
"displayNameEvent": "gateway known changed",
@ -415,7 +415,7 @@
"defaultValue": false
},
{
"id": "1b402ba6-a8ae-45b1-8acf-2b0a89f71889",
"id": "342a95f0-3fde-4987-8d0b-1c6859d39d24",
"name": "dtsActive",
"displayName": "dts active",
"displayNameEvent": "dts active changed",
@ -423,7 +423,7 @@
"defaultValue": false
},
{
"id": "639360f0-bb65-43e6-b227-50ae0ac39d6c",
"id": "fa0f73f8-52ce-4bb5-9a48-1fb38b2a72f0",
"name": "deviceMode",
"displayName": "device mode",
"displayNameEvent": "device mode changed",
@ -431,7 +431,7 @@
"defaultValue": -1
},
{
"id": "ff5194e3-5641-4ac2-92c7-48c431b4a2eb",
"id": "37494abf-6fac-4294-b70a-86a48c3bd092",
"name": "deviceModeString",
"displayName": "device mode string",
"displayNameEvent": "device mode string changed",
@ -439,7 +439,7 @@
"defaultValue": "-"
},
{
"id": "579aa8c6-8814-491b-9e7c-b98108c323d1",
"id": "19d3ce6e-a1bc-4727-8827-62545c82fe13",
"name": "desiredTemperature",
"displayName": "desired temperature",
"displayNameEvent": "desired temperature changed",

View File

@ -56,21 +56,21 @@
"createMethods": ["discovery"],
"paramTypes": [
{
"id": "9eda783f-6d9f-4d39-986d-d2cbfff5a7dd",
"id": "b45ca4a8-c67a-411c-957c-0e78e1f12c0b",
"name": "gpio",
"displayName": "GPIO",
"type": "int",
"defaultValue": -1
},
{
"id": "2204d278-7bc7-407f-ac82-ce3ae1d5779c",
"id": "efd3df4a-d2b6-44f3-9095-7bba07891735",
"name": "pin",
"displayName": "Pin number",
"type": "int",
"defaultValue": -1
},
{
"id": "504798eb-1faa-4703-a57a-2778e4bf9a67",
"id": "720bb37e-56e6-419e-878e-8c80aaf7ce32",
"name": "description",
"displayName": "Description",
"type": "QString",
@ -102,21 +102,21 @@
"createMethods": ["discovery"],
"paramTypes": [
{
"id": "9eda783f-6d9f-4d39-986d-d2cbfff5a7dd",
"id": "62a9596d-fc7d-4554-9f45-9803635da619",
"name": "gpio",
"displayName": "GPIO",
"type": "int",
"defaultValue": -1
},
{
"id": "2204d278-7bc7-407f-ac82-ce3ae1d5779c",
"id": "14f65be0-ee84-42e4-8fcb-d98a9926a247",
"name": "pin",
"displayName": "Pin number",
"type": "int",
"defaultValue": -1
},
{
"id": "504798eb-1faa-4703-a57a-2778e4bf9a67",
"id": "760aa4ed-d933-4188-aec8-16285d763aa5",
"name": "description",
"displayName": "Description",
"type": "QString",
@ -125,7 +125,7 @@
],
"stateTypes": [
{
"id": "06843766-358e-44b0-8d52-2b46ef98459a",
"id": "82b567c6-a33c-484e-b5e7-e04795498d00",
"name": "powerValue",
"displayName": "Power",
"type": "bool",
@ -143,21 +143,21 @@
"createMethods": ["discovery"],
"paramTypes": [
{
"id": "9eda783f-6d9f-4d39-986d-d2cbfff5a7dd",
"id": "20773255-4576-4c8e-8c8b-051902919761",
"name": "gpio",
"displayName": "GPIO",
"type": "int",
"defaultValue": -1
},
{
"id": "2204d278-7bc7-407f-ac82-ce3ae1d5779c",
"id": "f383bf1d-3ac0-4808-a82c-18748baf085d",
"name": "pin",
"displayName": "Pin number",
"type": "int",
"defaultValue": -1
},
{
"id": "504798eb-1faa-4703-a57a-2778e4bf9a67",
"id": "da746cde-2380-4ee5-bf2c-017249fcdeef",
"name": "description",
"displayName": "Description",
"type": "QString",
@ -166,7 +166,7 @@
],
"stateTypes": [
{
"id": "57f1b7cc-26c8-434b-ba04-d3077dc886c8",
"id": "22440876-417a-4d57-8e01-efe26ef9f235",
"name": "pressed",
"displayName": "Pressed",
"type": "bool",

View File

@ -91,7 +91,7 @@
],
"stateTypes": [
{
"id": "8daac0e7-4c2f-4cdf-b528-02cfe04c6b39",
"id": "4959c589-4550-479f-ae11-c4d1097ce3d5",
"name": "status",
"displayName": "Status code",
"displayNameEvent": "Status code changed",
@ -99,7 +99,7 @@
"defaultValue": 200
},
{
"id": "69f32ec8-114d-43f4-9241-1f6a57261f32",
"id": "22f8be58-be2b-4dba-b1ca-6c2a16dec533",
"name": "response",
"displayName": "Response",
"displayNameEvent": "Response received",
@ -149,7 +149,7 @@
],
"stateTypes":[
{
"id": "8daac0e7-4c2f-4cdf-b528-02cfe04c6b39",
"id": "8a60ffe0-e39a-43ec-be8c-c1ed1886aa41",
"name": "status",
"displayName": "Status code",
"displayNameEvent": "Status code changed",

View File

@ -79,6 +79,31 @@ Device::DeviceSetupStatus DevicePluginNetatmo::setupDevice(Device *device)
return Device::DeviceSetupStatusSuccess;
} else if (device->deviceClassId() == outdoorDeviceClassId) {
qCDebug(dcNetatmo) << "Setup netatmo outdoor module" << device->params();
// Migrate device parameters after changing param type UUIDs in 0.14.
QMap<QString, ParamTypeId> migrationMap;
migrationMap.insert("a97d256c-e159-4aa0-bc71-6bd7cd0688b3", outdoorDeviceNameParamTypeId);
migrationMap.insert("157d470a-e579-4d0e-b879-6b5bfa8e34ae", outdoorDeviceMacParamTypeId);
ParamList migratedParams;
foreach (const Param &oldParam, device->params()) {
QString oldId = oldParam.paramTypeId().toString();
oldId.remove(QRegExp("[{}]"));
if (migrationMap.contains(oldId)) {
ParamTypeId newId = migrationMap.value(oldId);
QVariant oldValue = oldParam.value();
qCDebug(dcNetatmo()) << "Migrating netatmo outdoor station param:" << oldId << "->" << newId << ":" << oldValue;
Param newParam(newId, oldValue);
migratedParams << newParam;
} else {
migratedParams << oldParam;
}
}
device->setParams(migratedParams);
// Migration done
NetatmoOutdoorModule *outdoor = new NetatmoOutdoorModule(device->paramValue(outdoorDeviceNameParamTypeId).toString(),
device->paramValue(outdoorDeviceMacParamTypeId).toString(),
device->paramValue(outdoorDeviceBaseStationParamTypeId).toString(),

View File

@ -158,14 +158,14 @@
"createMethods": ["auto"],
"paramTypes": [
{
"id": "a97d256c-e159-4aa0-bc71-6bd7cd0688b3",
"id": "719e1f92-a9c8-42d6-83e1-652a0f182209",
"name": "name",
"displayName": "name",
"type": "QString",
"inputType": "TextLine"
},
{
"id": "157d470a-e579-4d0e-b879-6b5bfa8e34ae",
"id": "73a76c5c-84f5-4e65-8541-457e5aca9bb0",
"name": "mac",
"displayName": "mac address",
"type": "QString",
@ -183,7 +183,7 @@
],
"stateTypes": [
{
"id": "50da9f6b-c350-401c-a72e-2e4036f3975d",
"id": "154aad5c-4998-43c2-b9ee-0b997eb6dd69",
"name": "updateTime",
"displayName": "last update",
"displayNameEvent": "last update changed",
@ -192,7 +192,7 @@
"defaultValue": 0
},
{
"id": "3cb25538-e463-40ae-92f9-8f34f0c06b92",
"id": "f98776bd-887e-4b01-a87f-3d8224180563",
"name": "temperature",
"displayName": "temperature",
"displayNameEvent": "temperature changed",
@ -201,7 +201,7 @@
"defaultValue": 0
},
{
"id": "ae8bb713-8805-4efd-89a1-bca44a1f1690",
"id": "b71e0c8b-3c94-421e-830e-dab97b6c104e",
"name": "temperatureMin",
"displayName": "temperature minimum",
"displayNameEvent": "temperature minimum changed",
@ -210,7 +210,7 @@
"defaultValue": 0
},
{
"id": "dd30507e-037b-4c74-bcca-e04b94c7c5fe",
"id": "aae071dc-70d5-4a6a-8daa-3dca0d150bd7",
"name": "temperatureMax",
"displayName": "temperature maximum",
"displayNameEvent": "temperature maximum changed",
@ -219,7 +219,7 @@
"defaultValue": 0
},
{
"id": "e2db5f01-196a-48d1-8874-6b8cbfe0d8c9",
"id": "7ba6ddeb-5142-4b87-9729-487fcda394df",
"name": "humidity",
"displayName": "humidity",
"displayNameEvent": "humidity changed",

View File

@ -255,10 +255,35 @@ Device::DeviceSetupStatus DevicePluginPhilipsHue::setupDevice(Device *device)
HueLight *hueLight = new HueLight(this);
hueLight->setHostAddress(bridge->hostAddress());
hueLight->setApiKey(bridge->apiKey());
hueLight->setId(device->paramValue(dimmableLightDeviceLightIdParamTypeId).toInt());
// Migrate device parameters after changing param type UUIDs in 0.14.
QMap<QString, ParamTypeId> migrationMap;
migrationMap.insert("095a463b-f59e-46b1-989a-a71f9cbe3e30", dimmableLightDeviceModelIdParamTypeId);
migrationMap.insert("3f3467ef-4483-4eb9-bcae-84e628322f84", dimmableLightDeviceTypeParamTypeId);
migrationMap.insert("1a5129ca-006c-446c-9f2e-79b065de715f", dimmableLightDeviceUuidParamTypeId);
migrationMap.insert("491dc012-ccf2-4d3a-9f18-add98f7374af", dimmableLightDeviceLightIdParamTypeId);
ParamList migratedParams;
foreach (const Param &oldParam, device->params()) {
QString oldId = oldParam.paramTypeId().toString();
oldId.remove(QRegExp("[{}]"));
if (migrationMap.contains(oldId)) {
ParamTypeId newId = migrationMap.value(oldId);
QVariant oldValue = oldParam.value();
qCDebug(dcPhilipsHue()) << "Migrating hue white light param:" << oldId << "->" << newId << ":" << oldValue;
Param newParam(newId, oldValue);
migratedParams << newParam;
} else {
migratedParams << oldParam;
}
}
device->setParams(migratedParams);
// Migration done
hueLight->setModelId(device->paramValue(dimmableLightDeviceModelIdParamTypeId).toString());
hueLight->setUuid(device->paramValue(dimmableLightDeviceUuidParamTypeId).toString());
hueLight->setType(device->paramValue(dimmableLightDeviceTypeParamTypeId).toString());
hueLight->setUuid(device->paramValue(dimmableLightDeviceUuidParamTypeId).toString());
hueLight->setId(device->paramValue(dimmableLightDeviceLightIdParamTypeId).toInt());
connect(hueLight, &HueLight::stateChanged, this, &DevicePluginPhilipsHue::lightStateChanged);
@ -276,6 +301,31 @@ Device::DeviceSetupStatus DevicePluginPhilipsHue::setupDevice(Device *device)
HueRemote *hueRemote = new HueRemote(this);
hueRemote->setHostAddress(bridge->hostAddress());
hueRemote->setApiKey(bridge->apiKey());
// Migrate device parameters after changing param type UUIDs in 0.14.
QMap<QString, ParamTypeId> migrationMap;
migrationMap.insert("095a463b-f59e-46b1-989a-a71f9cbe3e30", remoteDeviceModelIdParamTypeId);
migrationMap.insert("3f3467ef-4483-4eb9-bcae-84e628322f84", remoteDeviceTypeParamTypeId);
migrationMap.insert("1a5129ca-006c-446c-9f2e-79b065de715f", remoteDeviceUuidParamTypeId);
ParamList migratedParams;
foreach (const Param &oldParam, device->params()) {
QString oldId = oldParam.paramTypeId().toString();
oldId.remove(QRegExp("[{}]"));
if (migrationMap.contains(oldId)) {
ParamTypeId newId = migrationMap.value(oldId);
QVariant oldValue = oldParam.value();
qCDebug(dcPhilipsHue()) << "Migrating hue remote param:" << oldId << "->" << newId << ":" << oldValue;
Param newParam(newId, oldValue);
migratedParams << newParam;
} else {
migratedParams << oldParam;
}
}
device->setParams(migratedParams);
// Migration done
hueRemote->setId(device->paramValue(remoteDeviceSensorIdParamTypeId).toInt());
hueRemote->setModelId(device->paramValue(remoteDeviceModelIdParamTypeId).toString());
hueRemote->setType(device->paramValue(remoteDeviceTypeParamTypeId).toString());

View File

@ -366,28 +366,28 @@
"createMethods": ["auto"],
"paramTypes": [
{
"id": "095a463b-f59e-46b1-989a-a71f9cbe3e30",
"id": "6fe78769-abef-4738-b968-2ff4c3b2a152",
"name": "modelId",
"displayName": "model id",
"type" : "QString",
"readOnly": true
},
{
"id": "3f3467ef-4483-4eb9-bcae-84e628322f84",
"id": "0381053b-7ad6-4e67-baac-2b61248f08e3",
"name": "type",
"displayName": "type",
"type" : "QString",
"readOnly": true
},
{
"id": "1a5129ca-006c-446c-9f2e-79b065de715f",
"id": "90748a51-df5f-4e46-9841-d5782a9e7d58",
"name": "uuid",
"displayName": "uuid",
"type" : "QString",
"readOnly": true
},
{
"id": "491dc012-ccf2-4d3a-9f18-add98f7374af",
"id": "49df749a-9e67-4dc8-81d2-c521e7e8066e",
"name": "lightId",
"displayName": "light id",
"type" : "int",
@ -396,7 +396,7 @@
],
"stateTypes": [
{
"id": "19bb8d10-1b28-4ba3-99b7-a634138dcfde",
"id": "57f80677-745e-4cb1-b894-87d8542a7e8c",
"name": "connected",
"displayName": "reachable",
"displayNameEvent": "reachable changed",
@ -404,7 +404,7 @@
"type": "bool"
},
{
"id": "90aaffe5-6a76-47d2-a14a-550f60390245",
"id": "5995ecb7-b5e5-4f6a-b4d6-33c93497e5fb",
"name": "power",
"displayName": "power",
"displayNameEvent": "power changed",
@ -414,7 +414,7 @@
"writable": true
},
{
"id": "90e91f64-a208-468c-a5a2-7f47e08859e2",
"id": "2f062912-1159-423b-8143-48a8e69b9348",
"name": "brightness",
"displayName": "brightness",
"displayNameEvent": "brightness changed",
@ -430,12 +430,12 @@
],
"actionTypes": [
{
"id": "d25dcfbc-d28c-4905-80e3-300ffb1248f5",
"id": "ab30a83a-539e-4b3a-860a-434e87ca165f",
"name": "alert",
"displayName": "flash",
"paramTypes": [
{
"id": "8ace6f8c-b2c7-4d0d-a407-52a54ad0ab05",
"id": "a546f129-e0e5-497b-9536-2f7a132434df",
"name": "alert",
"displayName": "alert",
"type": "QString",
@ -456,21 +456,21 @@
"createMethods": ["auto"],
"paramTypes": [
{
"id": "095a463b-f59e-46b1-989a-a71f9cbe3e30",
"id": "5910da25-c1ad-417c-9130-8f04e8ef1e6e",
"name": "modelId",
"displayName": "model id",
"type" : "QString",
"readOnly": true
},
{
"id": "3f3467ef-4483-4eb9-bcae-84e628322f84",
"id": "a12c0dbf-29e3-4580-96b0-728f8277514d",
"name": "type",
"displayName": "type",
"type" : "QString",
"readOnly": true
},
{
"id": "1a5129ca-006c-446c-9f2e-79b065de715f",
"id": "3cdf9de1-ae23-47dc-a8bd-056a6707060c",
"name": "uuid",
"displayName": "uuid",
"type" : "QString",
@ -486,7 +486,7 @@
],
"stateTypes": [
{
"id": "19bb8d10-1b28-4ba3-99b7-a634138dcfde",
"id": "9f9fac89-2dcd-4db6-b214-0065662af62a",
"name": "connected",
"displayName": "reachable",
"displayNameEvent": "reachable changed",
@ -534,7 +534,7 @@
"displayName": "Button longpressed",
"paramTypes": [
{
"id": "e4e3eb3a-a7c4-49e3-9344-0b3f213e0b42",
"id": "42a9df25-cadb-494f-b20c-fa874e214f4c",
"name": "buttonName",
"displayName": "Button name",
"type": "QString",

View File

@ -1,59 +1,17 @@
TEMPLATE = lib
CONFIG += plugin
QMAKE_CXXFLAGS += -Werror -std=c++11 -g
QMAKE_LFLAGS += -std=c++11
CONFIG += link_pkgconfig
PKGCONFIG += nymea
HEADERS += $${OUT_PWD}/plugininfo.h \
$${OUT_PWD}/extern-plugininfo.h
# Check if this is a snap build
snappy{
INCLUDEPATH+=$$(SNAPCRAFT_STAGE)/usr/include/nymea
isEmpty(PLUGIN_PRI) {
exists($$[QT_INSTALL_PREFIX]/include/nymea/plugin.pri) {
include($$[QT_INSTALL_PREFIX]/include/nymea/plugin.pri)
} else {
message("plugin.pri not found. Either install libnymea1-dev or use the PLUGIN_PRI argument to point to it.")
message("For building this project without nymea installed system-wide, you will want to export those variables in addition:")
message("PKG_CONFIG_PATH=/path/to/build-nymea/libnymea/pkgconfig/")
message("CPATH=/path/to/nymea/libnymea/")
message("LIBRARY_PATH=/path/to/build-nymea/libnymea/")
message("PATH=/path/to/build-nymea/tools/nymea-plugininfocompiler:$PATH")
message("LD_LIBRARY_PATH=/path/to/build-nymea/libnymea/")
error("plugin.pri not found. Cannot continue")
}
} else {
message("Using $$PLUGIN_PRI")
include($$PLUGIN_PRI)
}
# Make the device plugin json file visible in the Qt Creator
OTHER_FILES += $$PWD/$${TARGET}/deviceplugin"$$TARGET".json
# NOTE: if the code includes "plugininfo.h", it would fail if we only give it a compiler for $$OUT_PWD/plugininfo.h
# Let's add a dummy target with the plugininfo.h file without any path to allow the developer to just include it like that.
# Create plugininfo file
plugininfo.target = $$OUT_PWD/plugininfo.h
plugininfo_dummy.target = plugininfo.h
plugininfo.depends = FORCE
plugininfo.commands = nymea-generateplugininfo --filetype i --jsonfile $$PWD/$${TARGET}/deviceplugin"$$TARGET".json --output plugininfo.h --builddir $$OUT_PWD
plugininfo_dummy.commands = $$plugininfo.commands
QMAKE_EXTRA_TARGETS += plugininfo plugininfo_dummy
# Create extern-plugininfo file
extern_plugininfo.target = $$OUT_PWD/extern-plugininfo.h
extern_plugininfo_dummy.target = extern-plugininfo.h
extern_plugininfo.depends = FORCE
extern_plugininfo.commands = nymea-generateplugininfo --filetype e --jsonfile $$PWD/$${TARGET}/deviceplugin"$$TARGET".json --output extern-plugininfo.h --builddir $$OUT_PWD
extern_plugininfo_dummy.commands = $$extern_plugininfo.commands
QMAKE_EXTRA_TARGETS += extern_plugininfo extern_plugininfo_dummy
# Clean up autogenerated plugin info files
plugininfo_clean.commands = rm -fv $$OUT_PWD/plugininfo.h $$OUT_PWD/extern-plugininfo.h
clean.depends = plugininfo_clean
QMAKE_EXTRA_TARGETS += clean plugininfo_clean
# Install translation files
TRANSLATIONS *= $$files($${PWD}/$${TARGET}/translations/*ts, true)
lupdate.depends = FORCE
lupdate.depends += plugininfo.h
lupdate.commands = lupdate -recursive -no-obsolete $$PWD/"$$TARGET"/"$$TARGET".pro;
QMAKE_EXTRA_TARGETS += lupdate
translations.path = /usr/share/nymea/translations
translations.files = $$[QT_SOURCE_TREE]/translations/*.qm
TRANSLATIONS += $$files($$[QT_SOURCE_TREE]/translations/*.ts, true)
# Install plugin
target.path = $$[QT_INSTALL_LIBS]/nymea/plugins/
INSTALLS += target translations

View File

@ -567,7 +567,7 @@
"paramTypes": [ ],
"stateTypes": [
{
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c",
"id": "2e51cb1b-9f6a-4a45-b23e-ab44e8ab28e9",
"name": "connected",
"displayName": "Connected",
"displayNameEvent": "Connected changed",
@ -677,7 +677,7 @@
"paramTypes": [ ],
"stateTypes": [
{
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c",
"id": "be0291ff-6041-433b-9121-a30ca4426b22",
"name": "connected",
"displayName": "Reachable",
"displayNameEvent": "Reachable changed",
@ -750,7 +750,7 @@
"paramTypes": [ ],
"stateTypes": [
{
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c",
"id": "0f108052-4a5a-49d2-ab02-d404b1f2e17a",
"name": "connected",
"displayName": "Reachable",
"displayNameEvent": "Reachable changed",
@ -809,7 +809,7 @@
"paramTypes": [ ],
"stateTypes": [
{
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c",
"id": "5fa28715-f5ea-4db5-99fe-5eceb8721c4a",
"name": "connected",
"displayName": "Reachable",
"displayNameEvent": "Reachable changed",
@ -817,7 +817,7 @@
"defaultValue": true
},
{
"id": "e1910c53-a6bc-434b-9caa-0d08e214c122",
"id": "1a47ba44-bbd8-4766-a648-5df49394b812",
"name": "power",
"displayName": "Power",
"displayNameEvent": "Power changed",
@ -953,7 +953,7 @@
"defaultValue": 0
},
{
"id": "169d7a2a-d1c9-4578-bb30-fc7d25690e59",
"id": "e75207e8-10a9-4bdc-974e-1e44e119ee23",
"name": "temperature",
"displayName": "Temperature",
"displayNameEvent": "Temperature changed",
@ -971,7 +971,7 @@
"defaultValue": 20
},
{
"id": "45c0de32-b519-47d7-9f82-e5f09d1542d4",
"id": "6a7ecb09-135c-4be2-8c36-f2a71711ea05",
"name": "batteryLevel",
"displayName": "Battery",
"displayNameEvent": "Battery level changed",
@ -982,7 +982,7 @@
"defaultValue": 0
},
{
"id": "295b9a17-a4b1-4cc9-8ebb-2309b72c75f6",
"id": "68d818fd-ad8a-411d-95b1-811991535fe2",
"name": "batteryCritical",
"displayName": "Battery critical",
"displayNameEvent": "Battery critical changed",
@ -990,7 +990,7 @@
"defaultValue": false
},
{
"id": "e66aba37-2647-4b6b-8740-d59eb98d846c",
"id": "b5e8ace1-983c-4bff-90ef-3af30257b158",
"name": "connected",
"displayName": "Connected",
"displayNameEvent": "Connected changed",
@ -1007,7 +1007,7 @@
"paramTypes": [ ],
"stateTypes": [
{
"id": "b7ff029d-f3a6-4b47-978a-ac1a581aac0f",
"id": "194f05a9-2c54-466c-a2a9-3d278fb41a2a",
"name": "power",
"displayName": "Power",
"displayNameEvent": "Power changed",

View File

@ -66,7 +66,7 @@
"interfaces": ["inputtrigger", "connectable"],
"paramTypes": [
{
"id": "bee8b151-815a-4159-9d8a-42b76e99b42c",
"id": "88eb227d-13f7-451c-babf-1b141c219fd4",
"name": "port",
"displayName": "Port",
"type": "int",
@ -97,7 +97,7 @@
],
"stateTypes": [
{
"id": "725b541a-9e0c-4634-81eb-e415c0b8f025",
"id": "a2eb1619-261c-45ee-9587-6b5994633ad0",
"name": "connected",
"displayName": "connected",
"type": "bool",