Rako Lighting

Hi Simon,

I tested the HACs repository and it works really well and is very easy to set up and all lights are immediately imported.

The benefit of RakoMqtt is that I can get access to the button presses from the Rako switches. I prefer to use home assistant scenes rather than Rako Scenes, and I can even use a rako button to control a non rako light. I’m guessing this functionality is impossible to include in the integration?


Hey Pete,

Glad it works for someone else.

Funny you mention that - being able to use the physical Rako switches to control other lights in HA is something that’s high on my list… struggling with WAF for a proliferation of other “smart switches” in the house, and this would help.

I did some testing a couple of days ago and the underlying Python library does receive the messages from the Rako Bridge that the switches have been pressed but decoding them and surfacing to HA is not implemented.

Since it matters to me, I will take a look at the mqtt implementation and see how hard it would be to move across.

Does the mqtt implementation create switch entities in HA or are you just taking the messages straight from the mqtt topic to handle your automations?

It looks like you’re using NodeRed for the automations. I’d be interested in doing it all in HA native automations so I need to investigate how to create the switch entities separately from the light entities in HA - as only the light entities are implemented in the library at present.


Hi Simon.

Not coded anything myself to do this, but MQTT does have a topic that works with HA that I think you should be able to post to.

Quick screen grab from my phone of the topic and some switches attached for reference.

Thanks for that.

Yes, I have other stuff that uses mqtt in HA it’s really the configuration flow for registering the switches as entities in HA and the representative MQTT topics that correspond to each switch that would need to be written.

Also, the Rako Bridge XML (mine at least) does not give you a list of switches you can retrieve and register so initial glance looks like you need to press a button in each to send a message which could then be registered which is rather inelegant.

At least, that’s what my first five minute glance at this suggested before our 6mo old kicked off and I had to drop it :sweat_smile:.

I will look at some other integrations in HA and see what I can crib from their code. I suspect that part is the easy bit but we’ll need to figure out how to get the list of switches from Rako Bridge without walking round the house! I may just email Rako themselves.

I’m also a bit worried they deprecate the bridge API and it might just be better to get a Hub and start using the latest API.


This is how I got the Rako buttons to work using RakoMQTT

Rasoft to create a virtual light

used the rampi and rasoft to trigger that virtual light with the button

I then used nodered to trigger from the mqtt node, but this could be doen with a HA automation

Okey dokey, I had a fiddle around in Rasoft. I thought to myself: if we could add a “fake” light actually bound to that channel we might be able to discover it using the code as it currently is… alas, I could not get this to work but it might just be that I was not uploading the fake light module to the Bridge correctly.

What I did establish is that using @ShawWellPete’s approach to add the channel to the physical keypad button I do get that button press event arriving in the event listener in the hacs_rako library:

DEBUG:python_rako.bridge:Received bytes: [83, 8, 0, 73, 4, 51, 128, 255, 0, 1]
WARNING:python_rako.helpers:Unsupported UDP message: message_type=MessageType.STATUS, byte_list=[83, 8, 0, 73, 4, 51, 128, 255, 0, 1]
DEBUG:python_rako.bridge:Deserialised received message as: UnsupportedMessage()
DEBUG:python_rako.bridge:Received bytes: [83, 8, 0, 73, 4, 51, 128, 255, 1, 0]
WARNING:python_rako.helpers:Unsupported UDP message: message_type=MessageType.STATUS, byte_list=[83, 8, 0, 73, 4, 51, 128, 255, 1, 0]
DEBUG:python_rako.bridge:Deserialised received message as: UnsupportedMessage()

So that at least gives us a way to get the button presses (provided they’re linked to a dummy channel) and subsequently do “something” with them. I need to add support for that button press message type and then figure out how we represent that as an entity in HA (or just push it to MQTT which is a bit hacky but pretty trivial).


1 Like

Thanks for all your help in porting this to HACS. I’m still plagued by an old problem however. I’ve pulled in the custom Repo. I’ve added the integration. It finds my bridge. However no lights. The following is in my logs:

Logger: homeassistant.components.light
Source: helpers/entity_platform.py:356
integration: Light ([documentation](https://www.home-assistant.io/integrations/light), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+light%22))
First occurred: 17:10:57 (1 occurrences)
Last logged: 17:10:57

Error while setting up rako platform for light

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform await asyncio.shield(awaitable) File "/config/custom_components/rako/light.py", line 47, in async_setup_entry async for light in bridge.discover_lights(session): File "/usr/local/lib/python3.12/site-packages/python_rako/bridge.py", line 163, in discover_lights for light in self.get_lights_from_discovery_xml(rako_xml): File "/usr/local/lib/python3.12/site-packages/python_rako/bridge.py", line 198, in get_lights_from_discovery_xml room_id = int(room["@id"]) ~~~~^^^^^^^ TypeError: string indices must be integers, not 'str'

I’d appreciate any help / guidance. I know the Room Number is 9 from exploring the XML but I don’t understand why it’s thinking it’s a String and not an Integer.


I dimly remember there was a fix to the python rako library in 0.0.14 for this. What’s in your custom_components/rako/manifest.json?

  "domain": "rako",
  "name": "Rako",
  "config_flow": true,
  "documentation": "https://www.home-assistant.io/integrations/rako",
  "requirements": ["python_rako==0.0.14"],
  "codeowners": [
  "iot_class": "local_push",
  "version": "0.0.0"

And this is what was imported / downloaded from the newly created HACS repo

  "domain": "rako",
  "name": "Rako",
  "codeowners": [
  "config_flow": true,
  "documentation": "https://github.com/SimonLeigh/hacs_rako",
  "integration_type": "hub",
  "iot_class": "local_push",
  "issue_tracker": "https://github.com/SimonLeigh/hacs_rako/issues",
  "requirements": [
  "version": "0.4.0"

Would you mind DMing me your xml please and I’ll take a look?

XML Details here: Rako Lighting - #148 by DeviousAl

Do you really have only one room defined? The XML you shared doesn’t seem problematic but I can’t help but wonder if in fact there are more rooms and a larger XML definition with an odd scenario where id is actually not cast-able as an integer so you get that error.

I tried to debug with that XML in the underlying library but got stuck in a hell of async code and have run out of time this evening.

OK, I can reproduce the bug. Let me see if I can fix it before I quit for the night.

Asking you if you only had one room gave me the solution I needed :slight_smile:

I have the fix but I’ll have to update the python-rako library on PyPi in order for it to work and I don’t know how to adopt that library and push a new version (yet).

FYI: line 196 in bridge.py in python-rako needs to become:

xml_dict = xmltodict.parse(xml, force_list={'Room'})

The bug occurs because you only have one room and the xml parser doesn’t create a list in that scenario so the subsequent code trying to index by id fails, as you experienced.


Ah amazing, thank you. Yes only one room - I inherited the house from an automation person that had control4 everywhere and rako just in one room of the house… Slowly been unpicking it and replacing with HA!

It simply is a hub - one wireless switch panel - that only does curtains open / close and main light on / off - the other references (lamps etc etc) seem to do nothing which I assume they had on some inline devices to their sockets.

Thank you for picking this up. I use @marengaz’s rako implementation so I appreciate your effort to move this over to hacs and keep it alive. The main challenge with the custom component is that it can get out of synch with the actual status of the lights and then fails to respond correctly to on/off commands. I find I have to revert to the Rako app or switch. There was a suggestion that Rako’s bridge isn’t great at retaining the state information but it is odd that Rako’s app can always switch a light/room off but the HA integration can’t.


Hi Tom,

Do you think that issue could be due to using Rako Scenes from switches?

My installer set up my system so the buttons usually activated Rako Scenes because I could then change those scenes from the app.

I found that RAKOMQTT did not detect the light changes from those scenes. I changed all the switches to trigger lights directly and now the status nearly always seems correct.

Hi Peter,

My switches do trigger scenes - I suspect that is standard usage. I need to run some tests to determine what causes the divergence between the real status and what HA shows. When the systems get out of sync I also can’t explain why a command from HA turn off a room (or an individual light) fails but the Rako app works fine.


Have you got rasoft and a rampi? if so try changing from scenes to switches on one switch and see how you get along with that one. As you can see in this example, one switch can trigger more than one light

You are right that scenes are stadard usage but not one that works with rakomqqt in my experience

Hi Peter,

I use rasoft to configure via a bridge on the network so I can have a look to see whether the switch-based approach works better.


1 Like