kiwi-cam/homebridge-broadlink-rm

operating RF Blinds not working consistently - Hex code issue?

Closed this issue · 10 comments

I successfully managed to integrate the BroadLink RM4 pro into Homekit using Homebridge with this plugin👍

I have 7 blinds that operate on individual 433.33 mhz remotes.
I set everything up and recovered the Hex codes for all the 7 remotes.

However, I now have the issue that operating the blinds basically works but not consistently.
I have to send commands multiple times until a blind starts moving (it varies), but then it works and reacts immediately to all commands. After some time has passed it becomes unresponsive again and the game starts over.

Could this be because of a not 100% matching Hex code? Should I try to retrieve them one more time?
No clue if this is even possible or if those codes either work 100% or not at all.
Thanks!

I've now scanned the Hex codes of one remote again a bunch of times.
Every time I get a different code, is that normal?

I implemented the new codes into the plugin but behaviour remains the same. The blinds are unresponsive at first and after sending multiple requests, they start working and respond immediately to new inputs.
After some time without inputs, they become unresponsive again.

I have tried downgrading the Firmware of the RM4 and also different builds of the plugin with no real success.
I can see in the log that the RF commands are send, but the blinds don't respond. After trying a couple of times they do to the same Hex code after all. No repositioning done or else, so it can't be a range issue either.

So I have the theory now that the issue lies with the duration of the send commands.
The "up/down" buttons on the remotes of the blinds need to be pressed about 2 seconds for them to respond, "stop" works instantly.

I had issues first with programming the BroadLink directly as well, but that one actually can learn long presses and after figuring that out, it worked flawlessly.

I think over Homekit the commands are not send long enough or just barely, that's why the blinds respond after multiple attempts. Since there is no "stop" command to send over Homekit, I can't test my theory. That one should work since there is no "time limit" for it.

Is there a way in the script to send the Hex commands longer?
Like a duration in ms that can be defined or something like that?
Thanks!

If the codes are for set positions, meaning timing isn't an issue, you might be able to get around this by resending the commands e.g.

    {
      "data": "HEX_CODE",
      "sendCount": 5,
      "interval": 0.2
    }

Thanks!
Do I have to implement the code like this for every blind?:

 "data": {
            "open": "HEX_Code",
            "close": "HEX_Code", 
            "stop": "HEX_Code",
            "sendCount": 5,
            "interval": 0.2

Or also for every command?

 "data": {
            "open": "HEX_Code",
            "sendCount": 5,
            "interval": 0.2
            "close": "HEX_Code", 
            "sendCount": 5,
            "interval": 0.2
            "stop": "HEX_Code",
            "sendCount": 5,
            "interval": 0.2

To answer my own question here, the code has to look like this for window covers:

"accessories": [
    {
        "name": "Living Room",
        "type": "window-covering",
        "totalDurationOpen": 55,
        "totalDurationClose": 60,
        "data": {
            "open": [
                {
                    "data": "HEX_Code",
                    "sendCount": 3,
                    "interval": 0.5
                }
            ],
            "close": [
                {
                    "data": "HEX_Code",
                    "sendCount": 3,
                    "interval": 0.5
                }
            ],
            "stop": "HEX_Code"
        }
    },

This repeats the "open" and "close" commands 3 times with half a second in between, but not the "stop" command.

Unfortunately the repeats have not solved my initial problem.

So I've done more testing and I made a discovering:
The repeats now assure that the blinds receive the commands. Right now I'm sending the commands 5 times with one second delay.

The issue comes when I group blindes (east/west) in Homekit and try to open/close entire groups at once. I can see in the scripts that the BroadLink is sending commands to all the blinds but for some reason they never all start moving.

Maybe too many commands get send at once and the BroadLink Hardware can't keep up?
When I use "scenes" in the BroadLink app, you can see that it slowly executes each command one by one.

No clue if this is actually a "bug" or caused by Homekit that could be corrected in the plugin.

I will now attempt to script a "combined blind" for east/west, using the "Multiple Codes & Repeats" commands.

I think I solved all issues now 😅

Issue 1 was that the blinds need a "long press" of the remote, something the BroadLink can learn using it's own app, but the Homebridge script could not. I solved this by repeating the command 20 times with 0.1 sec in between. No clue if a command takes longer to send than 0.1 sec but this at least assures me 2 solid seconds of constant "commanding".

Issue 2 occurred when I grouped two or more blinds together in Homekit. At least one would always not respond.
I figured this was due to Homebridge sending commands to every blind the same time, resulting in supposed RF interference.
At first I created another "window-covering" accessory and added HEX-Codes of multiple blinds with delays between them.
That basically worked but then I discovered the "initialDelay" key for the script which states:

This allows multiple window-covering accessories to be updated at the same time without RF/IR interference from one-another by adding an offset to each window-covering accessory.

I deleted the "window-covering" with the multiple HEX-Codes again and fittet every blind with an increasing "initialDelay", going up by 2 seconds each. That's a 12 seconds delay on the last blind, but that rules out any interference what so ever.

So far all manual tests have been successful. I set up an automation for sunset today and I hope it will work 🤞

I set up an automation for sunset today and I hope it will work 🤞

It did 🥳

That's awesome. Thanks for the update and sharing your solution.