RFLink KaKu remote dimmer buttons as shortcuts

I have an RFLink connected to HA and some KlikaanKlikuit (KaKu or CoCo) stuff connected. I recently dug up an old remote, the AYCT-202.

My plan was to use this for some shortcut buttons for around the house, for instance: on channel 1 I can turn music on with the ON button, pause it with OFF, and control volume with the dimmer buttons. Or on another channel assign a some script I have in HA.
I am NOT planning on using the dimmer buttons for what they are actually intended for, dimming lights.

And that is where I run into a snag. I was hoping to intercept the dimmer buttons with the RFLink and connect them via automations. But, they don’t send out “DIMMER DOWN” or “DIMMER UP” commands, but rather a “set_level=x” where x is a number between 0 and 15 corresponding to the dimming level.

If I press dimmer down button, I receive for instance this:

event_type: button_pressed
data:
  entity_id: switch.kaku_multichannel_2
  state: set_level=4

But I can’t link ‘set_level=4’ to this button, cause the next time I press it, it will go down to set_level=3.

My only idea right now is to make some complicated contraption trying to save the set_level state and compare after each button press to check if up or down was pressed. But before I even try such a thing, does anyone have an idea (or even experience) in directly using the input of these dimmer buttons?

Does the device have different entities for dimmer and on/off buttons?
If yes, then you can just catch the entity event (despite the set_level value) and trigger some action. But, this way you will lose one button.

Other way (that I’m not sure if can be done) would be to create a fake light that would catch the dimmers commands. This way you could trigger the automations with the light states (on/off/brightness_increase/brightness_decrease) and you don’t have to deal with the button set_level values.

1 Like

I believe that you can try the second approach if you define in RFLink integration your device as a light. You can hidde the light in HA but use it as a trigger for your automations.

1 Like

I’m afraid the entities are the same, the only difference is the command (either on, off or set_level=x).

Regarding using the ‘light’ workaround, do you mean that configuring a light in HA will give me access to dimmer up/down if the remote sends an absolute set_level value?
I think/hope I know what you mean but can’t test until tomorrow

I was wondering that if you configure in RFLink your device as a light, then you can make automations with the state changes from that light. I have reviewed that approach and the problem is that RFLink don’t generate devices (only entities) and the automations I was planning are for devices…
Not sure if the fake device approach is doable.

1 Like

I tried some things, and although the suggestion to configure it as a light is quite clever, it does not seem to work. Indeed, RFLink lights are not devices, but I could access brightness via a numeric state in an automation (or at least it looked that way). However, this is basically just a mirror of the (absolute) set_level values send by the remote. So no relative up or down change can be extracted.

What also seems the case is that the set_level=x sent out by the remote is not per channel. So for instance, I can crank up the ‘set_level’ on channel 2 to 15 (=max), than go to channel 3, and lower the set_level to 1. When I then return to channel 2, it has not remembered the set_level for this channel is 15! So when I press the decrease button on channel 2, the set_level decreases to 0 (from 1) instead of to the expected 14 (from 15). Don’t know how that is supposed to work with actual lights (have never had this actual connected to any lights), but it seems iffy.

Anyway, my conclusion for now is that a pure button mapping is impossible (or pretty difficult).
However, I like your suggestion to use the entity event despite the set_level, so I can at least have one button functionality. Thank you for thinking along.

1 Like