Rako Lighting

heya @hunterdrayman - i think there was a security problem at some point that affects custom components. the manifest.json file requires you to put a version in. heres an example in HACS
hopefully that will make it work?

1 Like

Great! Thank you. That did the trick. My bridge is on a VLAN isolated from the main network but when I put in the IP/MAC etc. it discovered my circuits (and areas too, I note - clever!).

Are you still interested in feedback? I don’t want to trouble you unnecessarily.

i wont be making any more changes to this PR because its taking ages to get approved and i feel like any extra stuff will slow it down further. following that though, sure. best place for it is probably this thread at the moment?

1 Like

I have frustrating little issue. I had the component installed manually (i think a version from May) and working with a few issues (sliders not updating, etc.). I grabbed the latest version (July) and simply copied over the directory in custom components and it fixed most of the problems but there were some oddities, so I tried a fresh install. As usual fixed the version in the manifest, added rako: to my configuration, rebooted. All the logs look good, but when I go to add the integration in HA the rako integration doesn’t appear!

I’m sure its something stupid I have done, but I can’t figure out what! Any ideas?

Grrr my bad - browser caching the integrations list. Sorted now.

It looks like I can switch my lights on & off from a standard light card (and use a dimming slider OK) but the UI switch/dimmer states only update when I restart HA. The logs show the command UDP packet going out, but nothing coming back. My Rako bridge and HA host are on separate VLANs - could this be the problem?

quite possibly. you can double check by using the rako app on your phone. press a button on one of your physical keypads and see if the app updates

Yup, that was it. I’ve had Rako kit for two years and never noticed that the phone app didn’t update when the physical buttons were pressed.
Fortunately, my HA host is a VM and it was easy to add another interface from it to the Rako bridge VLAN. The HA dials now update when I press a keypad button. Success! I just need to keep my fingers crossed that a multi-homed HA doesn’t break anything else.

@marengaz I have had rakomqtt working for a while. Until the proper integration gets approved what do you recommend, should I stick to what I have or install your new integration manually?

I should have some time this week to update the entities after the change.

@ShawWellPete If it helps, I have been using the integration for several months and have found it very stable. Using both the Rako bridge web API and the light.turn_on/off service has given me flexibility to select bridge-programmed scenes and to independently control channel-level brightness changes in Node-RED flows.
In that time I’ve had two problems: One where a reboot of the bridge and one where a reload of the integration were needed to set things right.
There’s one issue I yet need to solve. That’s where, sometimes a wall plate selected scene doesn’t update my Home Assistant dashboard with the new levels, but I suspect this is a network issue.

Thank you, what is the process for a new version of HA?

Configuration->Add Integration->Search for Rako and then follow the prompts

I have copied the rako directory from the downloaded core-rako and copied it to custom components (next to HACS), rebooted HA, then added rako: to the configuration.yaml and I get this error

2021-12-20_14-51-14

Don’t use HACS for this one. It’s a core integration.
Configuration->Add Integration->Search for Rako and then follow the prompts

Thanks for the reply, I didn’t try to use HACS but I copied the rako directory from the downloaded core-rako so it was in custom components (where HACS also is)

When I try to add in the integration as you described I get

2021-12-21_10-56-34

I must admit it’s a while since I added this integration so I may be misremembering. Anyhoo take a look back at Rako Lighting - #37 by ShawWellPete

It looks like you’ve been through this before.

I am trying to work out why the component becomes unresponsive each day and why a reload of the integration fixes the problem.
Normally, when I call the light turn_on/turn_off service it switches the light on or off and responds with some deserialised data from the bridge. Then something happens to disrupt the responses - in debug I can see the command being sent to the bridge but there’s no response coming back. e.g.

2022-02-10 10:05:12 DEBUG (MainThread) [python_rako.bridge] Sending command: CommandUDP(room=25, channel=1, command=<CommandType.SET_LEVEL: 52>, data=[1, 255], message_type=<MessageType.REQUEST: 82>)
2022-02-10 10:05:12 DEBUG (MainThread) [python_rako.bridge] Sending command bytes: [82, 7, 0, 25, 1, 52, 1, 255, 171]
2022-02-10 10:05:53 DEBUG (MainThread) [python_rako.bridge] Sending command: CommandUDP(room=9, channel=1, command=<CommandType.SET_LEVEL: 52>, data=[1, 0], message_type=<MessageType.REQUEST: 82>)
2022-02-10 10:05:53 DEBUG (MainThread) [python_rako.bridge] Sending command bytes: [82, 7, 0, 9, 1, 52, 1, 0, 186]

I simply issue a call to service reload_config_entry for the bridge and things are good for a few hours. I’ve not yet detected what might be triggering it. Commands are still received and the lights are changed as requested but there’s no response. I don’t need to reboot the bridge itself and the config reload is sufficient to cause HA core to register responses again. I can create an automation which periodically reloads it but it would be nice to get to the bottom of the problem.

The following might be incidental but this error is produced on reload:

2022-02-10 10:09:55 ERROR (MainThread) [homeassistant.components.light] Error while setting up rako platform for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/rako/light.py", line 51, in async_setup_entry
    hass_light = RakoRoomLight(bridge, light)
  File "/config/custom_components/rako/light.py", line 145, in __init__
    super().__init__(bridge, light)
  File "/config/custom_components/rako/light.py", line 67, in __init__
    self._brightness = self._init_get_brightness_from_cache()
  File "/config/custom_components/rako/light.py", line 150, in _init_get_brightness_from_cache
    brightness: int = convert_to_brightness(scene_of_room)
  File "/usr/local/lib/python3.9/site-packages/python_rako/helpers.py", line 177, in convert_to_brightness
    return _scene_brightness[scene_number]
KeyError: 5

hey @hunterdrayman

this is the code thats throwing the error that you posted. it naively assumes that only 4 scenes will ever exist and that they correspond to different levels of dimming.

what keypads are you using? i’ve only tested this integration with keypads like this (which have 4 scenes). i suspect that you have keypads that have more than 4 scenes? and that this error was thrown when you pressed scene number 5 (hence KeyError: 5)

fyi, i just moved house and had to leave my rako lights behind, so unfortunately i wont be able to enhance this integration :frowning:

hey @marengaz

Thank you for getting back to me and pointing me at the actual code. I’m gradually improving my knowledge of the way HA integrations are developed so this is interesting. I’m hugely impressed with what you’ve achieved here.

I have the same keypads as you illustrated in your link but I have programmed extra scenes in the RaSoft Pro app which allow me to long-press some buttons on my RCM-070 keypads for other purposes (e.g. A long-press of scene 1 by the exit door switches all house lights off). Also, I don’t use the dimmer buttons on the RCM-070 and have re-programmed some of these to control lights in an adjacent room.

I have asked Rako tech support about a firmware update and will install the latest version if that is possible. I’m on v 2.4.4 WTC at the moment and I believe v2.5.0 is the last one before they discontinued the product in favour of their WK-HUB.

Is there anything I can do to provide more diagnostic info? I’m quite handy with a code editor and know some python - if I can help at all.

When I reloaded the config this morning I got another error. I hope this helps, somehow:

2022-02-11 09:00:24 ERROR (MainThread) [homeassistant.components.light] Platform rako does not generate unique IDs. ID b:00:04:a3:b3:24:f2r:65c:8 already exists - ignoring light.kitchen_ex3_external_lights
2

Hi Ben,

Hope you are well. I have exactly the same issue; as long as I use the 4 physical buttons everything works perfectly however when you have additional scenes associated with physical button combinations programmed to the wall plates integration crashes and can no longer receive updates from the Rako bridge. I see you have mentioned that you moved houses recently for that I totally understand if you can no longer enhance / debug the integration further, however I am pretty sure people like myself who has no idea about programming at this level would very much appreciate your help :slight_smile: either way thank you so very much for creating this integration which is totally awesome as it is.

Issue Example :

Button 1 : Scene 1 ( Kitchen Spots)
Button 2 : Scene 2 ( Dining Spots)
Button 3 : Scene 3 ( Wall Lights)
Button 4 : Scene 4 ( Cabinet Lights)

Button 1 + Button 2 : Short press on release > delay less than 1 sec >> Kitchen Spots + Dining Spots
Button 1 + Button 3 : Short press on release > delay less than 1 sec >> Kitchen Spots + Wall Lights
etc…