Implement CMD=SET_LEVEL=X command in RFLINK module (closed issue #10814)

I am using the RFLink module to communicate with RF lights and switches (CoCo).
Some new products User the CMD=SET_LEVEL=X command to dim a light to a certain level. This command is implemented in the RFLINK firmware, but the RFLINK module in HA just implements the ON and OFF command.

All this means is that when I adjust my lights via a CoCo rotating dimmer, using the SET_LEVEL command, the status of the lights in HA are not updated.

This was all described in 2017 and 2019 in issue #10814 which was not solved but automatically closed.

Gr. Remco

just to be clear, can you confirm this points?:

  • Can you control your device from HA?
  • Can you use the ‘set_level’ function from HA? (brightness maybe?)
  • Your HA device react to ON/OFF remote command?
  • Your HA device DO NOT react to ‘set_level’ remote command?

In order to help you, we need you to include an example of the configuration that does not work, logs of the anomalous operation and all the information that you consider important.

From what I see, that functionality was included in the RFLink library:

And the new version has already been included in HA:

Event capture may not be implemented in HA, but it could also be that the device is not being identified (or configured) correctly. That is why we need the specific information of the device that is failing you.


I have two CoCo (KlikaanKlikuit) dimmers ACM-100 built into the wall.
I have two CoCo rotating dimmer knob WRT-1000 (new product) attached to the wall. These 2 are binded together and that Works fine

Next, i have set the RFLINK in HA to auto add to learn the Signal from the dimmer knob in HA. This also Works fine, I can control the dimmer from HA (on/off and dimmer).

The two dimmer knobs are recognized as: (id’s are both anonemized)


If I turn the lights on by pressing the dimmer knob, an ON command is Send and this is also detected by HA and the status of the light Goes to on.
Same for turning the light off by pressing the dimmer knob twice. The OFF command is sent and received by the RFLINK and sent to HA. The status of the light in HA is set to OFF.

What doesn’t work is when I rotate the dimmer to change the intensity or when I turn on the light by just turning the dimmer knob. The light turns on, but the status in HA is not updated.

I started RFLINK debugging in HA and I see the set_level command coming in HA through RFLINK.

2021-02-12 10:36:38 DEBUG (MainThread) [rflink.protocol] received data: 20;03;NewKaku;
2021-02-12 10:36:38 DEBUG (MainThread) [rflink.protocol] received data: ID=012345ab;SWITCH=c;CMD
2021-02-12 10:36:38 DEBUG (MainThread) [rflink.protocol] received data: =SET_LEVEL=15;
2021-02-12 10:36:38 DEBUG (MainThread) [rflink.protocol] got packet: 20;03;NewKaku;ID=012345ab;SWITCH=c;CMD=SET_LEVEL=15;
2021-02-12 10:36:38 DEBUG (MainThread) [rflink.protocol] decoded packet: {'node': 'gateway', 'protocol': 'newkaku', 'id': '012345ab', 'switch': 'c', 'command': 'set_level=15'}
2021-02-12 10:36:38 DEBUG (MainThread) [rflink.protocol] got event: {'id': 'newkaku_012345ab_c', 'command': 'set_level=15'}
2021-02-12 10:36:38 DEBUG (MainThread) [homeassistant.components.rflink] event of type command: {'id': 'newkaku_012345ab_c', 'command': 'set_level=15'}
2021-02-12 10:36:38 DEBUG (MainThread) [homeassistant.components.rflink] entity_ids: ['light.spots_boekenkast']
2021-02-12 10:36:38 DEBUG (MainThread) [homeassistant.components.rflink] passing event to light.spots_boekenkast
2021-02-12 10:36:42 DEBUG (MainThread) [rflink.protocol] received data: 20;04;NewKaku;ID
2021-02-12 10:36:42 DEBUG (MainThread) [rflink.protocol] received data: =012345ab;SWITCH=c;CMD=S
2021-02-12 10:36:42 DEBUG (MainThread) [rflink.protocol] received data: ET_LEVEL=14;
2021-02-12 10:36:42 DEBUG (MainThread) [rflink.protocol] got packet: 20;04;NewKaku;ID=012345ab;SWITCH=c;CMD=SET_LEVEL=14;
2021-02-12 10:36:42 DEBUG (MainThread) [rflink.protocol] decoded packet: {'node': 'gateway', 'protocol': 'newkaku', 'id': '012345ab', 'switch': 'c', 'command': 'set_level=14'}
2021-02-12 10:36:42 DEBUG (MainThread) [rflink.protocol] got event: {'id': 'newkaku_012345ab_c', 'command': 'set_level=14'}
2021-02-12 10:36:42 DEBUG (MainThread) [homeassistant.components.rflink] event of type command: {'id': 'newkaku_012345ab_c', 'command': 'set_level=14'}
2021-02-12 10:36:42 DEBUG (MainThread) [homeassistant.components.rflink] entity_ids: ['light.spots_boekenkast']
2021-02-12 10:36:42 DEBUG (MainThread) [homeassistant.components.rflink] passing event to light.spots_boekenkast
2021-02-12 10:36:42 ERROR (MainThread) [homeassistant.components.wled] Error fetching wled data: Invalid response from API: Error occurred while communicating with WLED device at
2021-02-12 10:36:46 DEBUG (MainThread) [rflink.protocol] received data: 20;05;NewKaku;ID=0
2021-02-12 10:36:46 DEBUG (MainThread) [rflink.protocol] received data: 12345ab;SWITCH=c;CMD=S
2021-02-12 10:36:46 DEBUG (MainThread) [rflink.protocol] received data: ET_LEVEL=11;
2021-02-12 10:36:46 DEBUG (MainThread) [rflink.protocol] got packet: 20;05;NewKaku;ID=012345bb;SWITCH=c;CMD=SET_LEVEL=11;
2021-02-12 10:36:46 DEBUG (MainThread) [rflink.protocol] decoded packet: {'node': 'gateway', 'protocol': 'newkaku', 'id': '012345bb', 'switch': 'c', 'command': 'set_level=11'}
2021-02-12 10:36:46 DEBUG (MainThread) [rflink.protocol] got event: {'id': 'newkaku_012345bb_c', 'command': 'set_level=11'}
2021-02-12 10:36:46 DEBUG (MainThread) [homeassistant.components.rflink] event of type command: {'id': 'newkaku_012345bb_c', 'command': 'set_level=11'}
2021-02-12 10:36:46 DEBUG (MainThread) [homeassistant.components.rflink] entity_ids: ['light.spots_uitbouw']
2021-02-12 10:36:46 DEBUG (MainThread) [homeassistant.components.rflink] passing event to light.spots_uitbouw

So the set_level command is picked up by HA through RFLINK, but the status of the light is not updated.
The light is configurated as following:

  - platform: rflink                      
    automatic_add: false                  
        name: Spots uitbouw     
        type: dimmable              
        name: Spots boekenkast                
        type: dimmable 

Gr. Remco

Thanks a lot for your detailed response.
It seems that the only point to review it’s the handle_event part for dimmable devices. Good.

Badly I don’t have any dimmable device to test. Could you test with your remote and get the max and minimum values that it gets for the set_level command?

I think I have a first version of the implementation, but I would like to know two more details of the behavior of the devices:

  1. when the minimum level is reached (set_level=0), does the device turn off? Can you hear the relay cutting?
  2. If from an intermediate level (eg: set_level=8) the device is turned off (with a command=off), when it is turned on again with of an on command, does it restore the dimmed state?

Thanks in advanced.

  • I have tested with two CoCo remotes ( AWRT-1000 and AYCT-202)
  • Both Send levels between 0 and 15 (set_level Value).
  • When a light is off I turn the knob clockwise, the light Goes on.
  • When I turn the knob counterclockwise, the set_level Value Goes down to zero, but the light stays on, on the lowest dim level.
  • When I turn the light off (pressing knob twice) and the on again (Press knob once) the light turns on to the last set dimlevel (so the dimmers have memory for the last used dim level).

If you need and more information, please let me know. Thanks in Advance for all your work.


Ok, based on your comments, we are going to assume the following behavior for the set_level command:

  • the set_level command turns the device ON
  • the set_level command DOES NOT turn off the device
  • device ‘remembers’ dim levels after going off

I’m curious about 2 behaviors in particular:

  • How does the device behave when, being turned off, a set_level = 0 command is sent to it? As seen so far, what would be expected would be to turn on at the minimum level
  • How does the device behave when it receives signals from 2 remotes? My guess is that each remote will have a separate dim level for the device and response to dim commands from diferent remotes will be ‘weird’.

When the command set_level=0 is received, the CoCo dimmer goes to the lowest intensity level but does not turn off.
When the light is off and I sent a command set_level=0 then the light turns on at the lowest intensity.

When 2 remotes are coupled to 1 dimmer, the dimmer wil jump between the levels which are sent from the 2 remotes. There is a small delay between receiving a set_level command and actually dimming, but it could indeed lead to ‘weird’ behaviour.

Thanks again for your tests.

The PR has been created:

I have not been able to validate the change locally.
If you dare to try it, we can do it using a custom_component. I can try to help you as much as I can.


Sure I Will try helping you to do some tests.
If you can tell me in short how to perform the tests.
I have Some experience with custom_components.

Gr. Remco

Let’s see if I can explain all the steps well …
You have to create within the ‘custom_components’ folder a new folder with the name you want, eg: rflink2

Inside this folder, the following files of the RFLink integration must be copied:

  • serices.yaml
  • manifest-json

For the the version of the PR must be used:

Once you have the files in the folder, the following modifications must be made:

  1. manifest.json
    Replace the content with something like:
  "domain": "rflink2",
  "name": "RFLink2",
  "documentation": "",
  "requirements": [
  "dependencies": ["rflink"],
  "codeowners": []
    The import statement must be replaced from:
import homeassistant.helpers.config_validation as cv

from . import (


import homeassistant.helpers.config_validation as cv

from homeassistant.components.rflink import (

Then your configuration will be something like:

  - platform: rflink2
    automatic_add: false
        name: Spots uitbouw     
        type: dimmable              
        name: Spots boekenkast                
        type: dimmable 

Restart HA and have a look at the logs. You must see something like this at startup:

2021-02-15 13:32:24 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for rflink2 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.


I finally got time to try your new code. I followed the instructions below, but when I check my config and restart the server I get:

Platform error light.rflink2 - Integration 'rflink2' not found.
18:06:11 – Home Assistant Core Integration (ERROR) - bericht kwam voor het eerst om 17:59:43 en verschijnt 2 keer

Gr. Remco

I think that indications are correct.
Can you double check that folder custom_components\rflink2 has been created and the 3 files are inside?
Also you can try to remove the requirements part from your manifest.json

I removed the requirements from the manifest.json and now it seems to work.
RFLINK2 is now up and running, I Will test the dimmers tonight when I am home again.

Gr. Remco

Thanks for reporting.


I tested the new RFLINK implementation yesterday and it seems to work ok. Whenever i turn on or dim a CoCo dimmer the status is imediately updated in HA. All other flink integrations also still work.

Do you want me to test/check anything else?

Thanks for your work.

Kind regards,


1 Like

Thanks for your offer but I believe that this would be enough.

Hope someone reviews the PR and gets approved.

And thanks for your support.

This change has been included in v2021.4 so you don’t need the CC any more.
I suggest you remove the rflink2 CC when you upgrade to version.