Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into inspelning
Browse files Browse the repository at this point in the history
  • Loading branch information
ebaauw committed Nov 26, 2024
2 parents c52d0a1 + 8ae69a9 commit 079b9e6
Show file tree
Hide file tree
Showing 247 changed files with 7,933 additions and 4,525 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.13)

project(de_rest_plugin VERSION 2.29.00 LANGUAGES C;CXX)
project(de_rest_plugin VERSION 2.29.01 LANGUAGES C;CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

Expand Down
46 changes: 1 addition & 45 deletions device_descriptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ static int DDF_MergeGenericBundleItems(DeviceDescription &ddf, DDF_ParseContext
static int DDF_ProcessSignatures(DDF_ParseContext *pctx, std::vector<U_ECC_PublicKeySecp256k1> &publicKeys, U_BStream *bs, uint32_t *bundleHash);
static DeviceDescription::Item *DDF_GetItemMutable(const ResourceItem *item);
static void DDF_UpdateItemHandlesForIndex(std::vector<DeviceDescription> &descriptions, uint loadCounter, size_t index);
static void DDF_UpdateItemHandles(std::vector<DeviceDescription> &descriptions, uint loadCounter);
static void DDF_TryCompileAndFixJavascript(QString *expr, const QString &path);
DeviceDescription DDF_LoadScripts(const DeviceDescription &ddf);

Expand Down Expand Up @@ -1871,48 +1870,6 @@ static void DDF_UpdateItemHandlesForIndex(std::vector<DeviceDescription> &descri
}
}

/*! Updates all DDF item handles to point to correct location.
\p loadCounter - the current load counter.
*/
static void DDF_UpdateItemHandles(std::vector<DeviceDescription> &descriptions, uint loadCounter)
{
for (size_t index = 0; index < descriptions.size(); index++)
{
DDF_UpdateItemHandlesForIndex(descriptions, loadCounter, index);
}

// int index = 0;
// U_ASSERT(loadCounter >= HND_MIN_LOAD_COUNTER);
// U_ASSERT(loadCounter <= HND_MAX_LOAD_COUNTER);

// ItemHandlePack handle;
// handle.description = 0;
// handle.loadCounter = loadCounter;

// for (DeviceDescription &ddf : descriptions)
// {
// ddf.handle = index++;
// handle.subDevice = 0;
// for (auto &sub : ddf.subDevices)
// {
// handle.item = 0;

// for (auto &item : sub.items)
// {
// item.handle = handle.handle;
// U_ASSERT(handle.item < HND_MAX_ITEMS);
// handle.item++;
// }

// U_ASSERT(handle.subDevice < HND_MAX_SUB_DEVS);
// handle.subDevice++;
// }

// U_ASSERT(handle.description < HND_MAX_DESCRIPTIONS);
// handle.description++;
// }
}

/*! Temporary workaround since DuktapeJS doesn't support 'let', try replace it with 'var'.
The fix only applies if the JS doesn't compile and after the modified version successfully
Expand Down Expand Up @@ -2343,6 +2300,7 @@ void DeviceDescriptions::readAllRawJson()

DBG_Printf(DBG_DDF, "DDF cache raw JSON DDF %s\n", pctx->filePath);
d->descriptions.push_back(std::move(result));
DDF_UpdateItemHandlesForIndex(d->descriptions, d->loadCounter, d->descriptions.size() - 1);
}
}
}
Expand All @@ -2363,8 +2321,6 @@ void DeviceDescriptions::readAllRawJson()

if (!d->descriptions.empty())
{
DDF_UpdateItemHandles(d->descriptions, d->loadCounter);

for (auto &ddf : d->descriptions)
{
ddf = DDF_MergeGenericItems(d->genericItems, ddf);
Expand Down
2 changes: 1 addition & 1 deletion devices/adeo/ldsenk02f_plug.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,4 @@
]
}
]
}
}
2 changes: 1 addition & 1 deletion devices/adeo/ldsenk09_keyfob.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@
"cl": "0x0501"
}
]
}
}
2 changes: 1 addition & 1 deletion devices/aeotec/WG001-Z01_range_extender.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
]
}
]
}
}
30 changes: 26 additions & 4 deletions devices/aubess/aubess_multi_sensor_TZ3000_bguser20.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,19 @@
},
{
"name": "attr/swversion",
"parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "../tuya/tuya_swversion.js"},
"read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "../tuya/tuya_swversion.js"
},
"read": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001"
}
},
{
"name": "attr/type"
Expand Down Expand Up @@ -115,8 +126,19 @@
{
"name": "attr/swversion",
"refresh.interval": 86400,
"parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "../tuya/tuya_swversion.js"},
"read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "../tuya/tuya_swversion.js"
},
"read": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001"
}
},
{
"name": "attr/type"
Expand Down
2 changes: 1 addition & 1 deletion devices/aubess/aubess_plug_TZ3000_hdopuwv6.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,4 @@
]
}
]
}
}
30 changes: 26 additions & 4 deletions devices/blitzwolf/bw_is4_multisensor.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,19 @@
{
"name": "attr/swversion",
"refresh.interval": 86400,
"parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "../tuya/tuya_swversion.js"},
"read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "../tuya/tuya_swversion.js"
},
"read": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001"
}
},
{
"name": "attr/type"
Expand Down Expand Up @@ -129,8 +140,19 @@
{
"name": "attr/swversion",
"refresh.interval": 86400,
"parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "../tuya/tuya_swversion.js"},
"read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "../tuya/tuya_swversion.js"
},
"read": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001"
}
},
{
"name": "attr/type"
Expand Down
59 changes: 50 additions & 9 deletions devices/blitzwolf/bw_shp13_smart_plug.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
{
"schema": "devcap1.schema.json",
"uuid": "0ba557b8-580f-43a0-b0e3-ce76f4f71b96",
"manufacturername": ["_TZ3000_3ooaz3ng", "_TZ3000_g5xawfcq", "_TZ3000_amdymr7l"],
"modelid": ["TS0121", "TS0121", "TS011F"],
"manufacturername": [
"_TZ3000_3ooaz3ng",
"_TZ3000_g5xawfcq",
"_TZ3000_amdymr7l"
],
"modelid": [
"TS0121",
"TS0121",
"TS011F"
],
"vendor": "BlitzWolf",
"product": "Electricity metering 16A EU plug (BW-SHP13)",
"sleeper": false,
Expand Down Expand Up @@ -36,8 +44,19 @@
},
{
"name": "attr/swversion",
"parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "../tuya/tuya_swversion.js"},
"read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "../tuya/tuya_swversion.js"
},
"read": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001"
}
},
{
"name": "attr/type"
Expand Down Expand Up @@ -96,7 +115,13 @@
},
{
"name": "attr/swversion",
"parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "../tuya/tuya_swversion.js"}
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "../tuya/tuya_swversion.js"
}
},
{
"name": "attr/type"
Expand Down Expand Up @@ -165,7 +190,13 @@
},
{
"name": "attr/swversion",
"parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "../tuya/tuya_swversion.js"}
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "../tuya/tuya_swversion.js"
}
},
{
"name": "attr/type"
Expand All @@ -181,8 +212,18 @@
},
{
"name": "state/consumption",
"read": {"at": "0x0000", "cl": "0x0702", "ep": 0, "fn": "zcl:attr" },
"parse": {"at": "0x0000", "cl": "0x0702", "ep": 0, "eval": "Item.val = Attr.val * 10"},
"read": {
"at": "0x0000",
"cl": "0x0702",
"ep": 0,
"fn": "zcl:attr"
},
"parse": {
"at": "0x0000",
"cl": "0x0702",
"ep": 0,
"eval": "Item.val = Attr.val * 10"
},
"refresh.interval": 300
},
{
Expand Down Expand Up @@ -248,4 +289,4 @@
]
}
]
}
}
55 changes: 47 additions & 8 deletions devices/blitzwolf/bw_shp15_smart_plug.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"schema": "devcap1.schema.json",
"uuid": "90a67336-789a-4284-89a9-6f07bcbd2c9a",
"manufacturername": ["_TZ3000_mraovvmm", "_TZ3000_u5u4cakc"],
"modelid": ["TS011F", "TS011F"],
"manufacturername": [
"_TZ3000_mraovvmm",
"_TZ3000_u5u4cakc"
],
"modelid": [
"TS011F",
"TS011F"
],
"vendor": "BlitzWolf",
"product": "Power monitoring 16A 3680W EU plug (BW-SHP15)",
"sleeper": false,
Expand Down Expand Up @@ -36,8 +42,19 @@
},
{
"name": "attr/swversion",
"parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "../tuya/tuya_swversion.js"},
"read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "../tuya/tuya_swversion.js"
},
"read": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001"
}
},
{
"name": "attr/type"
Expand Down Expand Up @@ -96,7 +113,13 @@
},
{
"name": "attr/swversion",
"parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "../tuya/tuya_swversion.js"}
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "../tuya/tuya_swversion.js"
}
},
{
"name": "attr/type"
Expand Down Expand Up @@ -165,7 +188,13 @@
},
{
"name": "attr/swversion",
"parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "../tuya/tuya_swversion.js"}
"parse": {
"fn": "zcl:attr",
"ep": 1,
"cl": "0x0000",
"at": "0x0001",
"script": "../tuya/tuya_swversion.js"
}
},
{
"name": "attr/type"
Expand All @@ -181,8 +210,18 @@
},
{
"name": "state/consumption",
"read": {"at": "0x0000", "cl": "0x0702", "ep": 0, "fn": "zcl:attr" },
"parse": {"at": "0x0000", "cl": "0x0702", "ep": 0, "eval": "Item.val = Attr.val * 10"},
"read": {
"at": "0x0000",
"cl": "0x0702",
"ep": 0,
"fn": "zcl:attr"
},
"parse": {
"at": "0x0000",
"cl": "0x0702",
"ep": 0,
"eval": "Item.val = Attr.val * 10"
},
"refresh.interval": 300
},
{
Expand Down
Loading

0 comments on commit 079b9e6

Please sign in to comment.