dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 503 forks source link

`file_hash` got outside the descriptor #7800

Closed Zehir closed 5 months ago

Zehir commented 5 months ago

Does the issue really belong here?

Is there already an existing issue for this?

Describe the bug

When requesting the DDF bundle list sometime the file_hash is not correctly added to the file and break the JSON format

Steps to reproduce the behavior

Use a large set of bundle (360) Do a request to get the descriptor list ; http://localhost/api/12345/ddf/descriptors?next=129 Sometime it's on the first page, sometime it's on next pages

My set of bundles : bundles.zip

Expected behavior

Getting the data like this;

{
    "660d780c995f77bad0face0bd539533006ce71729cc39bee5b4dfe511ff31aaa": {
        "uuid": "417af879-4d80-4816-ba08-b1b74aeead77",
        "product": "2 gang switch",
        "version_deconz": ">2.27.0",
        "last_modified": "2024-05-13T10:13:33.000Z",
        "device_identifiers": [
            [
                "3A Smart Home DE",
                "LXN59-2S7LX1.0"
            ]
        ],
        "file_hash": "cd11a4662f3d89118d402d863367f6c7e3607e2e7b5a96d79881903658a97e89"
    },
    "66d120985269ac3b8e927a3162ddf62cbf726b1e306d501fe85c8d27317f40ac": {
        "uuid": "3b5a1753-f33f-468b-85d0-73eb8d7e5606",
        "product": "TRADFRI motion sensor - E1525, E1745",
        "version_deconz": ">2.27.0",
        "last_modified": "2024-05-13T10:13:33.000Z",
        "device_identifiers": [
            [
                "IKEA of Sweden",
                "TRADFRI motion sensor"
            ]
        ],
        "file_hash": "07f65280b232c70b0159633ba57f71d26b51271e110403a6f925b6012ea180f7"
    }
}

But instead I got ;

{
    "660d780c995f77bad0face0bd539533006ce71729cc39bee5b4dfe511ff31aaa": {
        "uuid": "417af879-4d80-4816-ba08-b1b74aeead77",
        "product": "2 gang switch",
        "version_deconz": ">2.27.0",
        "last_modified": "2024-05-13T10:13:33.000Z",
        "device_identifiers": [
            [
                "3A Smart Home DE",
                "LXN59-2S7LX1.0"
            ]
        ]
    },
    "file_hash": "cd11a4662f3d89118d402d863367f6c7e3607e2e7b5a96d79881903658a97e89"
},
"66d120985269ac3b8e927a3162ddf62cbf726b1e306d501fe85c8d27317f40ac": {
    "uuid": "3b5a1753-f33f-468b-85d0-73eb8d7e5606",
    "product": "TRADFRI motion sensor - E1525, E1745",
    "version_deconz": ">2.27.0",
    "last_modified": "2024-05-13T10:13:33.000Z",
    "device_identifiers": [
        [
            "IKEA of Sweden",
            "TRADFRI motion sensor"
        ]
    ],
    "file_hash": "07f65280b232c70b0159633ba57f71d26b51271e110403a6f925b6012ea180f7"
},
}

On the first one the file hash got outside the descriptor and an extra } got added.

I did not find any special things with the bundles.

cd11a4662f3d89118d402d863367f6c7e3607e2e7b5a96d79881903658a97e89 is the file hash of the bundle 660d780c995f77bad0face0bd539533006ce71729cc39bee5b4dfe511ff31aaa

I tried multiple times with different set of bundle, the issues happen with a short list of bundles;

{
 "2abeb4b004fa2983aa3efa9ad8dee45cfb5feaf5878eb42c785e1f8763a52310": {
        "uuid": "01178dcc-3cae-426b-851c-ea705dd03b3a",
        "product": "PIR313",
        "version_deconz": ">2.27.0",
        "last_modified": "2024-05-13T10:13:33.000Z",
        "device_identifiers": [
            [
                "OWON",
                "PIR313"
            ]
        ]
    },
    "file_hash": "f0307a0cfa91acfc83e3f2371a9e0912e0b943db011221e06e450f24a52e9a52"
},
"2ad6717a10d26155eff04554d1b77f2325d734166be3d1928639f7e03b373c14": {
    "uuid": "11beee69-0025-48cd-be1c-1355301c61a1",
    "product": "STARKVIND Air purifier",
    "version_deconz": ">2.27.0",
    "last_modified": "2024-05-13T10:13:33.000Z",
    "device_identifiers": [
        [
            "IKEA of Sweden",
            "STARKVIND Air purifier"
        ],
        [
            "IKEA of Sweden",
            "STARKVIND Air purifier table"
        ]
    ],
    "file_hash": "0aead0b4f8e9a3fa878333fc85bd6161d847248e54c2d9c52959ad9fb3ce3d61"
},
}

But some time it's working;

{
    "2abeb4b004fa2983aa3efa9ad8dee45cfb5feaf5878eb42c785e1f8763a52310": {
        "uuid": "01178dcc-3cae-426b-851c-ea705dd03b3a",
        "product": "PIR313",
        "version_deconz": ">2.27.0",
        "last_modified": "2024-05-13T10:13:33.000Z",
        "device_identifiers": [
            [
                "OWON",
                "PIR313"
            ]
        ],
        "file_hash": "f0307a0cfa91acfc83e3f2371a9e0912e0b943db011221e06e450f24a52e9a52"
    },
    "2ad6717a10d26155eff04554d1b77f2325d734166be3d1928639f7e03b373c14": {
        "uuid": "11beee69-0025-48cd-be1c-1355301c61a1",
        "product": "STARKVIND Air purifier",
        "version_deconz": ">2.27.0",
        "last_modified": "2024-05-13T10:13:33.000Z",
        "device_identifiers": [
            [
                "IKEA of Sweden",
                "STARKVIND Air purifier"
            ],
            [
                "IKEA of Sweden",
                "STARKVIND Air purifier table"
            ]
        ],
        "file_hash": "0aead0b4f8e9a3fa878333fc85bd6161d847248e54c2d9c52959ad9fb3ce3d61"
    }
}

For some reason renaming a file that cause the issue to "____.ddf" fix the issue. Renaming it back to the real hash create the issue again. And sometime it's just shifting the issue by one entry

Screenshots

No response

Environment

deCONZ Logs

No response

Additional context

No response