Great, thank you, I’m happy to say I mostly kept the same names as the Rako Bridge, but looks like I’ll need to do some updating.
teeny error i didn’t see on my dev machine, because i never set up everything from a blank slate! nice catch!
i have now set up everything from scratch on a different machine and didnt find any more bugs.
here’s the fix i made to __init__.py
which you can replicate on your side - https://github.com/home-assistant/core/pull/45589/commits/440d38b2c80ce2668d0e8cb513ad3cbd1d3749ef
Thanks for continuing to develop this. I have installed as described but hitting an error when trying to connect to the bridge.
- I can connect and send commands using telnet on default port. I’ve closed all telnet sessions.
- It was working using the rakomqtt in portainer linked to mqtt broker. I’ve stopped that service though.
- It works using the iphone app but I’ve closed the app.
- I haven’t got rasoft running.
I found Rako at configuration > integrations > add integration
It prompts with the correct autopopulated bridge and port details, but then fails to connect to bridge.
I added the logger section above but nothing appearing in /config/home-assistant.log
Any thoughts?
Thanks
Richard
Hi Marengaz,
I managed to get it installed and mostly working correctly but there was a problem with the ui-lovelace. When I turned a light on or off, the state would not correctly update. I mostly use a combination of regular entities card and Custom Slider Entity Row, eg
type: entities
title: Floor 0
entities:
- type: section
label: Kitchen
- type: 'custom:slider-entity-row'
entity: light.kitchen_lh_downlights
name: Left
hide_when_off: true
toggle: true
- type: 'custom:slider-entity-row'
entity: light.kitchen_rh_downlights
name: Right
hide_when_off: true
toggle: true
- type: 'custom:slider-entity-row'
entity: light.kitchen_pelmet
name: Pelmet
hide_when_off: true
toggle: true
- type: section
label: Family Room
- type: 'custom:slider-entity-row'
entity: light.family_room_downlights
name: Ceiling
hide_when_off: true
toggle: true
- type: 'custom:slider-entity-row'
entity: light.family_room_pendant
name: Pendant
hide_when_off: true
toggle: true
- type: 'custom:slider-entity-row'
entity: light.family_room_tiffany
name: Tiffany Lamp
hide_when_off: true
toggle: true
- type: 'custom:slider-entity-row'
entity: light.family_room_reading_lamp
name: Reading Lamp
hide_when_off: true
toggle: true
- type: 'custom:slider-entity-row'
entity: light.family_room_picture_lamp
name: Picture Lamp
hide_when_off: true
toggle: true
- type: section
label: Dining Room
- type: 'custom:slider-entity-row'
entity: light.dining_room
hide_when_off: true
toggle: true
- type: section
label: Store Rooms
- type: 'custom:slider-entity-row'
entity: light.lower_hallway
name: Lower Hall Way
hide_when_off: true
toggle: true
- type: 'custom:slider-entity-row'
entity: light.boot_room
name: Boot Room
hide_when_off: true
toggle: true
- type: 'custom:slider-entity-row'
entity: light.plant_room
name: Plant Room
hide_when_off: true
toggle: true
- type: 'custom:slider-entity-row'
entity: light.pantry
name: Pantry
hide_when_off: true
toggle: true
- type: 'custom:slider-entity-row'
entity: light.wine_cellar
name: Wine Cellar
hide_when_off: true
toggle: true
The light would turn off the button pops back to the on position.
I have had to restore to the old method to keep my wife happy but I’ll be able to test further at the weekend
hey pete - good to hear you got the integration set up ok.
with the lovelace dash, maybe you can create an autogenerated dash alongside your custom one, just to make sure the behaviour is the same?
can you also add the debug logging config to your configuration file and let me know what you see when you hit wall plate switches vs hitting the same switch in hass? in the ‘logs’ page you will have to click ‘Load Full Home Assistant Log’ and search for ‘rako’
hey richard - thanks for taking the time to test this out!
did you reboot after adding the debug logging config? im not sure if this is necessary, but i think it is?
in the ‘logs’ page you will have to click ‘Load Full Home Assistant Log’ and search for ‘rako’.
this ‘cannot connect’ error may arise when the rako xml is not parsable. please can you send me your rako.xml? it can be found here: http://<your_bridge_ip>/rako.xml
Will do, may have to wait for the weekend
No problem - really hope I can get it working.
I’ve sent you a couple of direct messages with the result of the “rako” log search and the xml file.
i had to make quite significant changes (every file!) to adapt the integration to work for @ralc’s rako bridge, which doesn’t show its mac address. can you let us know it works now?
before copying the new files, please can you delete the old instance of the integration (on the configuration > integrations page)
then follow along this guide again to re-install?
note that it includes an extra reboot compared with last time. apparently the ‘bug’ pete first found was not a bug, just a quirk of custom components
Wow thanks @marengaz!
So good news is that it auto-detects and installs the integration fine. However it does not seem to find any entities.
To summarise my steps:
- Removed Rako: entry from configuration.yaml
- Emptied the light-channels.yaml I was using with the mqtt solution I was using previously
Installed the integration and restarted server.
Added Rako: entry and restarted server.
Log entries:
2021-02-02 21:27:07 DEBUG (MainThread) [python_rako.bridge] Requesting cache: RequestType.SCENE_LEVEL_CACHE
2021-02-02 21:27:17 WARNING (MainThread) [homeassistant.components.light] Setup of light platform rako is taking over 10 seconds.
2021-02-02 21:28:07 ERROR (MainThread) [homeassistant.components.light] Setup of platform rako is taking longer than 60 seconds. Startup will proceed without waiting any longer.
Thanks again.
Richard
making progress at least!
this bit where it times out is where hass asks the rako bridge what the light levels currently are, so it can set the initial brightness of the light.
i also bumped the version of my lib so that it reports some more logging
let me know what happens in the logs this time
Hi
Good news. It installs, registers the lights and I have some light control. Bravo!
However I am getting some odd behaviour. I’ll send you the annotated log readouts separately but basically …
For my dining room it identifies entities for:
- the room “Dining Room”; and
- the channel “Dining Room - Ceiling”
I created a lovelace card with those 2 entities added as lights.
- If I click Dining Room (room entity) it sets brightness to about full brightess and the switch icon returns to off position after a few secs but the light stays on. Repeated presses doesn’t change light brightness or switch it off. Switch icon always returns to start position (off).
- If I then click Dining Room - Ceiling (channel) it always goes to about half brightness (regardless of where slider is).
- Again repeated clicks or slider changes makes no difference to light brightness although switch always returns to off position
- However if I go back and click the to Dining Room (room) switch it sets brightness to what looks to be full brightness again.
So it is like the two switches, irrespective of slider position always default to a particular level and don’t switch off (although switch icon always flicks back to its original position after a couple of seconds).
I tailed and monitored the log and there is always an entry written to the log.
The pattern seems to be that:
-
For the Dining Room - Ceiling (the channel entity) switch, the command is always CommandType.SET_LEVEL: 52>, data=[1, 255].
-
For the Dining Room - Ceiling slider, it is always CommandType.SET_LEVEL: 52>, data=[1, X] where X is 1-255 depending on value of slider. So the level value is always set to 52 regardless of slider which would explain it always setting to about half brightness.
-
For the Dining Room (the room entity), the command is always: CommandType.SET_SCENE: 49>, data=[1, 1]
-
Moving the slider has no effect but the command is always CommandType.SET_SCENE: 49>, data=[1, X] where X is a number 1 to 4. I think where slider is in first 25% of range, X is 4, second 25% of range, X is 3 and so on. So channels in reverse order on slider.
-
I did wonder whether it was interpreting scene 49 as a scene (scene 3 based on the slider ranges observed above). However scene 3 is actually about 25% brightness and the lights are going on full which is equivalent to scene 1. So not sure how 49 is being translated as scene 1.
One final oddity but probably to be looked at separately:
- I tried pressing the wall panel buttons and observed entries being written in the log for scene 1, 2, 3 and 4. I also think I observed one entry corresponding to the fade up/down buttons.
- However it then stopped picking these commands.
- Then I noticed that the behaviour observed previously where the switch would start in off position and then return to off position after clicking it. That behaviour has now changed - it starts in the on position and returns to the on position a few secs after clicking. However clicking still sets the light at the values detailed above.
Sorry for the detail but hopefully useful.
Actually I just read the command pdf for Rako and can see that the 49 and 52 values are instruction codes for SET_SCENE and SET_LEVEL respectively so that is not the problem.
lets use this checklist to assess which functionalities work/dont work. you can reference which feature youre talking about when we chat
:heavy_check_mark: = works
:warning: = broken but fixable
:x: = broken, not fixable
:question: = unsure
discovery:
1. hass discovers bridge :heavy_check_mark:
1. hass discovers lights (room and channel) :heavy_check_mark:
1. hass gets info from bridge's cache on boot
a. room scenes
b. channel levels
non-hass control:
1. wall plate/rako app room scene activation
a. updates state of the room light in hass
b. updates state of the channel lights in hass
1. rako app channel level adjustment updates state of the channel light in hass
hass control:
1. changing the brightness of room light in hass
a. sets the correct scene in the rako app
b. activates the relevant lights
c. updates the state of the relevant room and channel lights in hass
1. changing the brightness of channel light in hass
a. changes the channel brightness in the rako app
b. activates the relevant channel light
c. updates the state of the relevant room and channel lights in hass
@ralc i think you are currently here:
= works
= broken but fixable
= broken, not fixable
= unsure
discovery:
- hass discovers bridge
- hass discovers lights (room and channel)
- hass gets info from bridge’s cache on boot
a. room scenes (bridge does send us this, but currently fails because of lack of channel level cache)
b. channel levels (bridge doesn’t send us this)
non-hass control:
- wall plate/rako app room scene activation
a. updates state of the room light in hass
b. updates state of the channel lights in hass (no channel level cache) - rako app channel level adjustment updates state of the channel light in hass
hass control:
- changing the brightness of room light in hass
a. sets the correct scene in the rako app
b. activates the relevant lights
c. updates the state of the relevant room and channel lights in hass - changing the brightness of channel light in hass
a. changes the channel brightness in the rako app
b. activates the relevant channel light
c. updates the state of the relevant room and channel lights in hass
UDP command are clearly not working for you, i wonder if HTTP commands will work?
please can you check for me what happens when you do the following commands:
test 1:
POST http://<bridge_ip>/rako.cgi?room=10&ch=1&lev=255
it should
- turn your dining room - ceiling light to 255 (100%)
- give you logs like this:
[python_rako.bridge] Received bytes: [#some list of numbers#]
[python_rako.bridge] Deserialised received message as: ChannelStatusMessage(room=10, channel=1, brightness=255)
- show the slider move in hass
test 2:
POST http://<bridge_ip>/rako.cgi?room=10&ch=0&sc=1
it should
- turn your dining room to scene 1
- give you logs like this:
[python_rako.bridge] Received bytes: [#some list of numbers#]
[python_rako.bridge] Deserialised received message as: SceneStatusMessage(room=10, channel=0, scene=1)
- show the slider move in hass
to post to http do this:
mac / linux terminal
curl -X POST http://...
windows… no idea. maybe download postman and try?
Hi many thanks for looking into this.
I think the problem may be my bridge. Its a WRE which is so old now it isn’t even listed under “obsolete”!
It is on firmware 1.3.7 and shows a 1.7.9 is available but does not allow me to with a message that “The model of bridge you have, does not recover frmo failed updates. It is recommended you do not upgrade.” Which doesn’t fill me with confidence. That said, the instructions say that this version supported http requests from version 1.1.7.
I wonder whether I just need to upgrade to a newer device. I’m considering the new RK-HUB.
I have tried executing the commands you listed. I get no output in HASS log. I get some output in Rasoft (below) but it seems incomplete.
I tried both doing this via SSH into my debian-based homeassistant box as well as just putting the url into browser. In all cases I get a “success!” acknowledgement but nothing happens .
I tried GET and POST and various different combinations of the commands below with different values for sc, ch, lev
curl -X GET http://192.168.86.101/rako.cgi?room=20&ch=0&sc=1
curl -X GET http://192.168.86.101/rako.cgi?room=20&ch=0&lev=1
curl -X GET http://192.168.86.101/rako.cgi?room=20&ch=0&com=1
curl -X POST http://192.168.86.101/rako.cgi?room=20&ch=0&lev=128
curl -X POST http://192.168.86.101/rako.cgi?room=20&ch=0&lev=255
When using Curl I get:
> richard@swindle:~$ curl -X POST http://192.168.86.101/rako.cgi?room=020&ch=1&com=01
> [1] 16180
> [2] 16181
>
> richard@swindle:~$ Success!
> [1]- Done curl -X POST http://192.168.86.101/rako.cgi?room=020
> [2]+ Done ch=1
Rasoft always shows this:
SND: st
st
HO:023 RO:0020 CH:000 GR:000
OK
>
Note that it is picking up the room correctly but channel is always 0 and GR (group command?) is always 0.
I noticed that it seems to repeat that command every 30 seconds or so even though I am not repeatedly triggering it.
i did suspect that your bridge might be pretty old after you sent me the xml. theres a lot of stuff missing in comparison to my xml
does it have a web ui? this is how i found out about the http control. pressing the buttons in there:
the rako hub integration docs do say that its backward compatible with the bridge, so that might be an option.
1 Introduction
The Rako HUB can be accessed via a REST API, TCP socket or the legacy interfaces specified in ‘Accessing The Rako Bridge’.
better double check with them that you dont have to upgrade your switches and light modules too!
Thanks. Yes the WRE does have a fairly crude web application it doesn;t look like what you posted though. I’ve ordered the hub - should be here in a few days - and will try then.