Adding Profalux ZigBee roller shutters via legacy code

I wanted to add Profalux rollet shutters to deCONZ. Following the advice I have just to

Just disable the DDF core, include your device with the legacy core, then re-enable DDF. (see https://github.com/dresden-elektronik/deconz-rest-plugin/issues/7492#issuecomment-1870427928

But I cannot find the option in the deCONZ GUI panel to do so. I have just basic, hypbrid or strict

Is there any way to check how to use this option?

I have just checked the code, and it have moved a lot since the last time, sorry.
There is a new part on top of the fonction

    if (permitJoinFlag)
    {
        // during pairing only proceed when device code has finished query Basic Cluster
        if (device->item(RAttrManufacturerName)->toString().isEmpty() ||
            device->item(RAttrModelId)->toString().isEmpty())
        {
            return;
        }
    }

So during the permit join, all the fonction will be skipped if a device miss a manufacture name or a model identifier.
And I don’t see workaround.

So no way to include Profalux shutters in deCONZ anymore! even that the legacy code permitted this?
@Smanar could you please let me know with which version of deCONZ you made the cleanup?
So I would install the n-1 version, include the nodes.

The code I have copy/paste is from the legacy core.
I think you need to use an 1 years old version at least (IDK when this code was added), so not a good idea.
Profalux don’t purpose new firmwares ?
Else it’s possible to edit the c++ code and recompile it without this part. I can explain how to do if you have a linux machine with full OS.

Thanks, actually I have tried to request from Profalux but by experience they are not so keen to answer to questions. Actually I have a Raspberry 4 with Bullseye on it, I don’t know if this is a full OS for you? I can have a try, if you help me to go through the exercise.
And finally I tried with deCONZ 2.11.5 and the roller shade joined immediately but then big issue with Homebridge and the plugins. So you are right it was not a good idea.

And if you make a zigbee backup using phoscon, then return to last deconz version and restore the backup ?

I can be wrong but this part can be used only during inclusion (because of the permitJoinFlag check).

Actually I have a Raspberry 4 with Bullseye on it, I don’t know if this is a full OS for you?

Yes it is, if you don’t use docker on it.
I have patched the code on this branch, but IDK what can happen, so better to make a zigbee backup first (using phoscon), the procedure don’t have impact on the database, it just create 1 file and replace it on the deconz instal, but on next reboot …

You have the procedure here https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/BUILDING.md
So for you, after having installed deconz (The code is based on realy last one, the future one, so better to use a recent version):

sudo apt-get update && sudo apt-get install --no-install-recommends -y qt5-default lsb-release ca-certificates build-essential pkg-config git libqt5serialport5-dev libqt5websockets5-dev qtdeclarative5-dev sqlite3 libsqlite3-dev libgpiod-dev libssl-dev curl cmake ninja-build
git clone --branch profalux_4 https://github.com/Smanar/deconz-rest-plugin.git
cd deconz-rest-plugin
cmake -DCMAKE_INSTALL_PREFIX=/usr -G Ninja -B build
cmake --build build
cmake --install build --prefix tmp
sudo cp tmp/share/deCONZ/plugins/libde_rest_plugin.so /usr/share/deCONZ/plugins

It can use a lot the CPU/Hard drive (at least the first time, compilation will be faster after).
To rollback fastly you can make a backup of the file /usr/share/deCONZ/plugins/libde_rest_plugin.so in another folder.

If you still want to try the adventure and have error, just copy/paste me the error message, the procedure to compile the lib is WIP and can need some adjustement, but it have worked for an user with the same OS recently.

Thanks @Smanar, the process was cristal clear. For the record I had to replace qt5-default with qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
The displayed version of deCONZ is 2.25.0 (I am sure that this is yours, because I installed the latest stable version 2.24.2)
I made a join with the control Panel the Basic/Gold. I see again the 2 nodes in the deCONZ-gui. But not in the lights nor any other device through Phoscon app so there are not exposed to HomeBridge!

Actually how can I be sure that the legacy code is used?

I appreciate a lot your time and your attention to this.
Thanks again.

2 nodes ? This is not normal, you need to have only 1.
If you use the “Basic” mode, as your device don’t have DDF, it will use the legacy code.

Can you share some logs when doing inclusion ? (just with flag “info” and “info_l2”)
To make fast, you can just turn the permit join (using add new light in Phoscon) and ask node descriptor using the GUI.

Thanks for the feed-back. Actually I was doing the permit join directly from the deCONZ-gui and the results are not exactly the same than doing it through Phoscon. This time I followed exactly what you suggested:
starting deCONZ-gui in debug mode (info & info_l2) and then add new lights through Phoscon. 2 nodes were added color light 2 (actually the roller shutter as a router)


another node 0x4B77 (end device, I presume that this might be the remote control)

I am now able to see the roller shutter as a light in Homebridge (some issue with the level of brightness and on/off) I have to check the old discussion on these to see if I can sort this out.
Please find below the log file (as advised through Pastebin): deCONZ log - Pastebin.com

Better to use site like Pastebin for logs, It take so much place on forum.

Ha yes I forget the remote, but from previous issue I don’t remember it was included too in same time.

Profalux have another problem, they are not “covering” devices but “light” one. So yes can have others issues after. I have just see a new “hack” in code for them, but for me this one is already working.

From my memory need to use them like light, and profalux ask for using the cluster 0x0008 (so the set level) instead of the 0x0006 (the on/off).

My bigger question is how it will react after a reboot, As the device is already included I hope the hack will be not usefull.

Thanks again @Smanar, I you speak about the “va et vient” “up and down” every 30 minutes, no I don’t have them. I can confirm that on/off is not working correctly. I have to test on the level brightness.

My last question for today :wink: once they devices joined deCONZ can I then upgrade without any issue to the latest version of deCONZ or I have to use your special version from now on?

I will make an update on the usage of the brightness in the next few days.

Meanwhile Happy new year to you and thanks for your support.

Bonne fetes ^^

Ha yes, lol I forget this hack too, lol this brand need so much of them.

My last question for today :wink: once they devices joined deCONZ can I then upgrade without any issue to the latest version of deCONZ or I have to use your special version from now on?

Good question, for me yes, as the code modification on the branch you are using is To test · Smanar/deconz-rest-plugin@9298ca5 · GitHub
I can purpose a definitive code modification, but as it’s a “hack” not sure it will be valided.

So it’s just a bypass during the permit join, mean one time the device is included, it is not used.

For the on/off there is this hack

    // Special part for Profalux device
    // This device is a shutter but is used as a dimmable light, so need some hack
    if (taskRef.lightNode->modelId() == QLatin1String("PFLX Shutter"))
    {
        if (hasOn && !hasBri)
        {
            hasBri = true;
            targetBri = targetOn ? 0xFE : 0x00;
        }
        hasOn = false; // use bri instead

        if (hasBriInc)
        {
            targetBriInc = 0; // only use for stop
            hasBri = false;
        }
        else
        {
            isOn = true; // to force bri even when off
            if (targetBri > 0xFE) { targetBri = 0xFE; }
            if (targetBri < 1) { targetBri = 0x01; }
        }
    }

Mean if you use the on/off request it use the set level request, this hack need to work too, so it’s strange the on/off don’t working for you.

{
  "e": "added",
  "id": "2",
  "light": {
    "capabilities": {
      "alerts": [
        "none",
        "select",
        "lselect"
      ]
    },
    "config": {
      "groups": [
        "0"
      ]
    },
    "etag": "613f911284a3c7b6633d5d0eb5bbf1b3",
    "hascolor": false,
    "lastannounced": null,
    "lastseen": "2023-12-30T14:54Z",
    "manufacturername": "Profalux",
    "modelid": "PFLX Shutter",
    "name": "Color light 2",
    "state": {
      "alert": "none",
      "bri": 0,
      "on": false,
      "reachable": true
    },
    "swversion": null,
    "type": "Color light",
    "uniqueid": "20:91:8a:00:00:03:ab:1e-01"
  },
  "r": "lights",
  "t": "event",
  "uniqueid": "20:91:8a:00:00:03:ab:1e-01"
}

Dear @Smanar,
now I can confirm, that the on/off is also working, the issue is that the brightness is between 1 to 254, so on HomeKit the device is always on, because of value 1. There is an issue in your code because the brightness is between 1 to 254 so it is never 0. So you have to check with brightness 1 and not 0 for off.
But anyway the whole thing is working as designed even though it is not perfect.
I know that I don’t have to much weight on the community, if you can integrate the issue in the code of the next deCONZ 2.25.1 that would be wonderful, because we supported this device before and we cannot let down the users for the future.
Let me know if I can be of any help.
Thanks again for your “formidable” support.

Ha yes, in the code the minimum value is 0x01 not 0x00, but I don’t remember why …
Have check faslty an pipiche do it too, so there is probably a reason.

I have make a “cleaner hack” to submit a definitive PR

    if ((node->nodeDescriptor().manufacturerCode() != VENDOR_PROFALUX) && permitJoinFlag)
    {
        // during pairing only proceed when device code has finished query Basic Cluster
        if (device->item(RAttrManufacturerName)->toString().isEmpty() ||
            device->item(RAttrModelId)->toString().isEmpty())
        {
            return;
        }
    }

If you can test it first ?
As you already have compiled the code will be faster now

cd deconz-rest-plugin
git pull
cmake -DCMAKE_INSTALL_PREFIX=/usr -G Ninja -B build
cmake --build build
cmake --install build --prefix tmp
sudo cp tmp/share/deCONZ/plugins/libde_rest_plugin.so /usr/share/deCONZ/plugins

I have compiled the code, please confirm that I need to delete the node and then rejoin with the new code that I have compiled?

Just a note on the behaviour of this hardware: as cluster 6 (on/off) was not active, you created a hack to simulate an ON by setting the brightness to 254 cluster 8 (Level Control) and simulating the OFF by setting the brightness to 1. As brightness is between 1 to 254 on our case.
The only thing is that on my Homebridge the shutter is never OFF because of brightness 1. But everything is working.

I hope that I was clear. Waiting for your validation to test your code.

Yep, for test, better to make a test in “real” with an “out of the box” device.

The only thing is that on my Homebridge the shutter is never OFF because of brightness 1

Yep, but from what I m reading, it 's not a bug, but this device need it. I can’t use the 0 value.

Dear @Smanar,
I can confirm that it is working now (between us, I had to make a hard reset on the roller shutter by removing the frame of the shutter, so I can access the power cables. I will not do it twice :wink: ).
So I hope that you can submit the PR and it will be accepted. I you could kindly give me the number of the PR so I can also follow it.
Last thing, if the PR is included in the next deCONZ; after the deCONZ update do I have to make a clean rejoin or I just update deCONZ?
Thanks again for all the time that you spent on this matter.
A charge de revanche.

Oups sorry, I thought it was easier, we could have done it differently.

Last thing, if the PR is included in the next deCONZ; after the deCONZ update do I have to make a clean rejoin or I just update deCONZ?

Can just update deconz, even the PR is not valided, for me this hack is only usefull for the inclusion, after …

PR > FIX permit the Profalux covering Support. by Smanar · Pull Request #7510 · dresden-elektronik/deconz-rest-plugin · GitHub