diff --git a/flowercare/integrationpluginflowercare.json b/flowercare/integrationpluginflowercare.json index 0c459177..9a3e9f00 100644 --- a/flowercare/integrationpluginflowercare.json +++ b/flowercare/integrationpluginflowercare.json @@ -13,7 +13,7 @@ "name": "flowerCare", "displayName": "Flower Care", "createMethods": ["discovery"], - "interfaces": ["temperaturesensor", "lightsensor", "moisturesensor", "conductivitysensor", "wirelessconnectable", "batterylevel"], + "interfaces": ["temperaturesensor", "lightsensor", "moisturesensor", "conductivitysensor", "wirelessconnectable", "battery"], "paramTypes": [ { "id": "fe2dba0f-2a47-463e-a645-bcd55cf09750", diff --git a/fronius/froniusstorage.cpp b/fronius/froniusstorage.cpp index 49492c68..e8a9e312 100644 --- a/fronius/froniusstorage.cpp +++ b/fronius/froniusstorage.cpp @@ -84,7 +84,7 @@ void FroniusStorage::updateThingInfo(const QByteArray &data) // copy retrieved information to thing states if (storageInfoMap.contains("StateOfCharge_Relative")) { pluginThing()->setStateValue(storageBatteryLevelStateTypeId, storageInfoMap.value("StateOfCharge_Relative").toInt()); - if ((pluginThing()->stateValue(storageChargingStateTypeId) != "charging") && (storageInfoMap.value("StateOfCharge_Relative").toInt() < 5)) { + if (!pluginThing()->stateValue(storageChargingStateTypeId).toBool() && (storageInfoMap.value("StateOfCharge_Relative").toInt() < 5)) { pluginThing()->setStateValue(storageBatteryCriticalStateTypeId, true); } else { pluginThing()->setStateValue(storageBatteryCriticalStateTypeId, false); @@ -122,11 +122,6 @@ void FroniusStorage::updateActivityInfo(const QByteArray &data) QVariantMap dataMap = jsonDoc.toVariant().toMap().value("Body").toMap().value("Data").toMap(); float charge_akku = dataMap.value("Site").toMap().value("P_Akku").toFloat(); - if (charge_akku == 0) { - pluginThing()->setStateValue(storageChargingStateTypeId, "inactive"); - } else if (charge_akku < 0) { - pluginThing()->setStateValue(storageChargingStateTypeId, "charging"); - } else { - pluginThing()->setStateValue(storageChargingStateTypeId, "discharging"); - } + pluginThing()->setStateValue(storageChargingStateTypeId, charge_akku < 0); + pluginThing()->setStateValue(storageDischargingStateTypeId, charge_akku > 0); } diff --git a/fronius/integrationpluginfronius.json b/fronius/integrationpluginfronius.json index ae9a7e16..f3ca58b3 100644 --- a/fronius/integrationpluginfronius.json +++ b/fronius/integrationpluginfronius.json @@ -278,7 +278,7 @@ "name": "storage", "displayName": "Fronius solar storage", "createMethods": ["auto"], - "interfaces": [ "batterylevel", "connectable" ], + "interfaces": [ "battery", "connectable" ], "paramTypes": [ { "id": "9665c38b-c13a-428f-b741-1470239c63dc", @@ -318,10 +318,18 @@ { "id": "2de34a1f-de2e-43ad-8998-8a5460dff9ae", "name": "charging", - "displayName": "State of charge", - "displayNameEvent": "Charge state changed", - "type": "QString", - "defaultValue": "-" + "displayName": "Charging", + "displayNameEvent": "Charging changed", + "type": "bool", + "defaultValue": false + }, + { + "id": "be90d35c-081c-485b-b4cc-8271e7da5796", + "name": "discharging", + "displayName": "Discharging", + "displayNameEvent": "Discharging changed", + "type": "bool", + "defaultValue": false }, { "id": "5c6da672-9662-41bc-8c8c-aa0f32481251", diff --git a/netatmo/integrationpluginnetatmo.json b/netatmo/integrationpluginnetatmo.json index 160a4b42..8692a8c7 100644 --- a/netatmo/integrationpluginnetatmo.json +++ b/netatmo/integrationpluginnetatmo.json @@ -183,7 +183,7 @@ "id": "6cc01d62-7317-4ec4-8ac4-a4cab762c179", "name": "outdoor", "displayName": "Outdoor Station", - "interfaces": ["temperaturesensor", "humiditysensor", "batterylevel", "wirelessconnectable"], + "interfaces": ["temperaturesensor", "humiditysensor", "battery", "wirelessconnectable"], "createMethods": ["auto"], "paramTypes": [ { diff --git a/philipshue/integrationpluginphilipshue.json b/philipshue/integrationpluginphilipshue.json index 245fd5f6..6e97a370 100644 --- a/philipshue/integrationpluginphilipshue.json +++ b/philipshue/integrationpluginphilipshue.json @@ -424,7 +424,7 @@ "id": "bb482d39-67ef-46dc-88e9-7b181d642b28", "name": "remote", "displayName": "Hue Remote", - "interfaces": ["longpressmultibutton", "batterylevel", "wirelessconnectable"], + "interfaces": ["longpressmultibutton", "battery", "wirelessconnectable"], "createMethods": ["auto"], "paramTypes": [ { @@ -664,7 +664,7 @@ "id": "32dc6390-600f-4eb4-b349-cc2d6796a82a", "name": "outdoorSensor", "displayName": "Hue Outdoor Sensor", - "interfaces": ["presencesensor", "temperaturesensor", "lightsensor", "batterylevel", "wirelessconnectable"], + "interfaces": ["presencesensor", "temperaturesensor", "lightsensor", "battery", "wirelessconnectable"], "createMethods": ["auto"], "paramTypes": [ { @@ -807,7 +807,7 @@ "id": "25b79fff-4b88-4af8-b06c-2fe246238790", "name": "motionSensor", "displayName": "Hue Motion Sensor", - "interfaces": ["presencesensor", "temperaturesensor", "lightsensor", "batterylevel", "wirelessconnectable"], + "interfaces": ["presencesensor", "temperaturesensor", "lightsensor", "battery", "wirelessconnectable"], "createMethods": ["auto"], "paramTypes": [ { diff --git a/senic/integrationpluginsenic.json b/senic/integrationpluginsenic.json index b8dc8862..add36c92 100644 --- a/senic/integrationpluginsenic.json +++ b/senic/integrationpluginsenic.json @@ -29,7 +29,7 @@ "name": "nuimo", "displayName": "Nuimo", "createMethods": ["discovery"], - "interfaces": ["simplemultibutton", "longpressbutton", "connectable", "batterylevel"], + "interfaces": ["simplemultibutton", "longpressbutton", "connectable", "battery"], "paramTypes": [ { "id": "71553f6a-2ed4-4896-bb7b-52e7dca948b2", diff --git a/shelly/integrationpluginshelly.json b/shelly/integrationpluginshelly.json index ec628351..9ab7616a 100644 --- a/shelly/integrationpluginshelly.json +++ b/shelly/integrationpluginshelly.json @@ -939,7 +939,7 @@ "name": "shellyButton1", "displayName": "Shelly button 1", "createMethods": ["discovery"], - "interfaces": ["longpressmultibutton", "wirelessconnectable", "batterylevel", "update"], + "interfaces": ["longpressmultibutton", "wirelessconnectable", "battery", "update"], "paramTypes": [ { "id": "ef42a9f5-b6f4-4bb9-ad17-a9419be4a44e", @@ -1266,7 +1266,7 @@ "name": "shellyHT", "displayName": "Shelly H&T", "createMethods": ["discovery"], - "interfaces": ["temperaturesensor", "humiditysensor", "wirelessconnectable", "batterylevel", "update"], + "interfaces": ["temperaturesensor", "humiditysensor", "wirelessconnectable", "battery", "update"], "paramTypes": [ { "id": "b6882bd5-7b1f-447b-9aa7-34aeeb538697", diff --git a/simulation/integrationpluginsimulation.cpp b/simulation/integrationpluginsimulation.cpp index 62226a20..78dd33e9 100644 --- a/simulation/integrationpluginsimulation.cpp +++ b/simulation/integrationpluginsimulation.cpp @@ -322,7 +322,7 @@ void IntegrationPluginSimulation::executeAction(ThingActionInfo *info) int maxCharging = action.param(batteryMaxChargingActionMaxChargingParamTypeId).value().toInt(); thing->setStateValue(batteryMaxChargingStateTypeId, maxCharging); qCDebug(dcSimulation()) << "Set max charging power" << maxCharging << "for battery" << thing->name(); - thing->setStateValue(batteryChargingStateTypeId, maxCharging); + thing->setStateValue(batteryChargingStateTypeId, true); return info->finish(Thing::ThingErrorNoError); } return info->finish(Thing::ThingErrorActionTypeNotFound); diff --git a/simulation/integrationpluginsimulation.json b/simulation/integrationpluginsimulation.json index 781205d4..6c3f6b9a 100644 --- a/simulation/integrationpluginsimulation.json +++ b/simulation/integrationpluginsimulation.json @@ -54,7 +54,7 @@ "name": "temperatureSensor", "displayName": "Temperature sensor", "createMethods": ["user"], - "interfaces": ["temperaturesensor", "humiditysensor", "batterylevel", "connectable"], + "interfaces": ["temperaturesensor", "humiditysensor", "battery", "connectable"], "paramTypes": [ ], "stateTypes": [ { @@ -886,10 +886,9 @@ "id": "c977e60a-e820-4647-addb-cf0b39732ffb", "name": "charging", "displayName": "Charging", - "displayNameEvent": "Charging amount changed", - "type": "double", - "unit": "KiloWatt", - "defaultValue": 0.70 + "displayNameEvent": "Charging changed", + "type": "bool", + "defaultValue": false }, { "id": "bdf328a6-eebc-4b67-8165-551bc21e9be6", diff --git a/zigbeegeneric/integrationpluginzigbeegeneric.json b/zigbeegeneric/integrationpluginzigbeegeneric.json index f5767c2c..6afaa025 100644 --- a/zigbeegeneric/integrationpluginzigbeegeneric.json +++ b/zigbeegeneric/integrationpluginzigbeegeneric.json @@ -13,7 +13,7 @@ "name": "thermostat", "displayName": "Zigbee Thermostat", "createMethods": ["auto"], - "interfaces": ["thermostat", "temperaturesensor", "batterylevel", "wirelessconnectable"], + "interfaces": ["thermostat", "temperaturesensor", "battery", "wirelessconnectable"], "paramTypes": [ { "id": "f38746d8-0084-43a3-b645-3ec743ea5fbc", @@ -243,7 +243,7 @@ "id": "34cb3d09-dd9f-4b95-95d0-30a1cd94adac", "setupMethod": "JustAdd", "createMethods": [ "Auto" ], - "interfaces": [ "simpleclosable", "batterylevel", "wirelessconnectable" ], + "interfaces": [ "simpleclosable", "battery", "wirelessconnectable" ], "paramTypes": [ { "id": "484bf80f-5d20-4029-b05e-6b4c9fbefd69", diff --git a/zigbeephilipshue/integrationpluginzigbeephilipshue.json b/zigbeephilipshue/integrationpluginzigbeephilipshue.json index 25f9db21..b52598a5 100644 --- a/zigbeephilipshue/integrationpluginzigbeephilipshue.json +++ b/zigbeephilipshue/integrationpluginzigbeephilipshue.json @@ -14,7 +14,7 @@ "id": "b2711164-a848-4715-8ddf-33ca86f9f4cf", "setupMethod": "JustAdd", "createMethods": [ "Auto" ], - "interfaces": [ "multibutton", "batterylevel", "wirelessconnectable" ], + "interfaces": [ "multibutton", "battery", "wirelessconnectable" ], "paramTypes": [ { "id": "b221cad1-ef2e-4192-8168-11d0205a43da", @@ -106,7 +106,7 @@ "name": "smartButton", "displayName": "Hue Smart button", "createMethods": ["Auto"], - "interfaces": ["longpressbutton", "batterylevel", "wirelessconnectable"], + "interfaces": ["longpressbutton", "battery", "wirelessconnectable"], "paramTypes": [ { "id": "2c2bd259-b1cd-47f4-825f-03c3806a346f", @@ -192,7 +192,7 @@ "id": "031c45d1-e782-4f91-9f05-259d6b81c7ef", "setupMethod": "JustAdd", "createMethods": [ "Auto" ], - "interfaces": [ "presencesensor", "lightsensor", "temperaturesensor", "batterylevel", "wirelessconnectable" ], + "interfaces": [ "presencesensor", "lightsensor", "temperaturesensor", "battery", "wirelessconnectable" ], "paramTypes": [ { "id": "a866df99-7e2a-40e1-b82e-529c03846d5e", diff --git a/zigbeetradfri/integrationpluginzigbeetradfri.json b/zigbeetradfri/integrationpluginzigbeetradfri.json index fab02bda..253af03f 100644 --- a/zigbeetradfri/integrationpluginzigbeetradfri.json +++ b/zigbeetradfri/integrationpluginzigbeetradfri.json @@ -14,7 +14,7 @@ "id": "2007e8ae-4849-47f6-98d6-ea6769c8ebd9", "setupMethod": "JustAdd", "createMethods": [ "Auto" ], - "interfaces": [ "longpressmultibutton", "batterylevel", "wirelessconnectable" ], + "interfaces": [ "longpressmultibutton", "battery", "wirelessconnectable" ], "paramTypes": [ { "id": "8b33f5cb-d1a3-4ae6-837a-d88e77252185", @@ -128,7 +128,7 @@ "id": "19ee3f56-f958-4b04-8ea3-747b72d7c7d6", "setupMethod": "JustAdd", "createMethods": [ "Auto" ], - "interfaces": [ "multibutton", "batterylevel", "wirelessconnectable" ], + "interfaces": [ "multibutton", "battery", "wirelessconnectable" ], "paramTypes": [ { "id": "2ee18d3e-5fb8-4809-a52a-8e420b677f6e", @@ -228,7 +228,7 @@ "id": "a18e398d-c14b-4bcd-8e6d-b64737436814", "setupMethod": "JustAdd", "createMethods": [ "Auto" ], - "interfaces": [ "longpressmultibutton", "batterylevel", "wirelessconnectable" ], + "interfaces": [ "longpressmultibutton", "battery", "wirelessconnectable" ], "paramTypes": [ { "id": "fa6544fd-9023-4c01-8600-7cc2f93aa4ca", @@ -342,7 +342,7 @@ "id": "30a1090e-8058-4a5b-aee3-4ba112ba3ba7", "setupMethod": "JustAdd", "createMethods": [ "Auto" ], - "interfaces": [ "presencesensor", "batterylevel", "wirelessconnectable" ], + "interfaces": [ "presencesensor", "battery", "wirelessconnectable" ], "paramTypes": [ { "id": "a03fabac-df59-4f4c-a691-237b1c37270f",