Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child Bridges #138

Open
agunn opened this issue Jan 31, 2023 · 14 comments
Open

Child Bridges #138

agunn opened this issue Jan 31, 2023 · 14 comments

Comments

@agunn
Copy link

agunn commented Jan 31, 2023

I've not had a lot of interaction on github regarding this great interface to c-bus for quite some time (2016 actually - since the addition of a the network option in accessory) but have been receiving the emails from github. I just wondered what might be involved to support Child Bridges and if it would be relatively easy. I'm happy to give it a go but I suspect there are faster/smarter people on here than me!

I've hit the wall on the 149 accessory limit (and today I tried to run a config.json on a pi and it won't support anywhere near that - I haven't counted but perhaps only 99-100? accessories).

https://github.com/homebridge/homebridge/wiki/Child-Bridges

OK - Immediately after I posted I saw this #119 re same thing. Apologies. I have added the _bridge option but it didn't seem to do anything so wondered if it is ignored in the homebridge-cbus implementation of accessory? Thanks

@DarylMc
Copy link

DarylMc commented Jan 31, 2023

Hi @agunn
I've just commented here to try keep in the loop for this topic.
At the moment I'm also try to setup a child bridge arrangement for a user with greater than 150 CBus group addresses.

@malowe1
Copy link

malowe1 commented Jan 27, 2024

@agunn, @DarylMc - have you managed to get child bridges to work for cbus?
Are you able to post an image / script for a working homebridge-cbus child bridge here?
I'm following the links to help pages and guidance, but a working example for cbus config would help greatly.
Cheers,

@JasonY00
Copy link
Contributor

JasonY00 commented Jan 30, 2024

I can’t say that I pursued the child bridge concept too much. It didn’t seem to work. My solution was to just run up another instance of Homebridge and split the CBus accessories between the two. Not ideal, but it works well. It is, however running on Windows 10.

I also ran into a c-bus problem where I had more than 256 group address on the lighting app, so I defined and started using another lighting app on $57. So generally, I split application $56 GA’s on instance 1 of Homebridge and application $57 GA’s on instance 2. If you update the Homebridge plugins on one instance, it updates for both on Win10. They run as two separate services.

Doing the same on a pi should be just as simple. A new pi should have no trouble doing this from a cpu and RAM loading point of view.

Let me know if you want to look into this. A maximum of 149 accessories is the magic number. As a footnote , this technique is deprecated, but for c-bus, it still works!

cheers

Jason

@malowe1
Copy link

malowe1 commented Feb 1, 2024

Thanks @JasonY00 - I don't have that many accessories, addresses or want to have separate HomeBridge instances. I'm guessing no-one is bothering with the recommendation to set cbus up as a child bridge(s). Will leave it until something definitive is provided. Cheers, Mike

@JasonY00
Copy link
Contributor

JasonY00 commented Feb 1, 2024

I think if you don't need to do it, then don't complicate things. It's not always worth doing something just because you can. You can have all of your other plugins as a child bridge and just leave c-bus in the main config by itself.

If you are not hitting the 149 accessories limit in homebridge then its not worth the trouble of child bridges/extra instances. I don't know if Anthony is actively developing this plugin anymore, so just keep the configuration vanilla flavoured!

Can you close this issue if you are satisfied with the answer?

Cheers

Jason

@SulVento2
Copy link

Hello,

I not sure if this is related but I am having a similar problem. I have 90 groups in my C-Bus installation. Most are physical devices but some relate to virtual devices such as group timers or group controls. I added all the groups into the json configuration file and Homebridge except the file and runs perfectly. I can control any group, physical or virtual from the Homebridge control panel without any problems.

My problem is when I try to add the accessory to HomeKit. The synchronisation process starts but I get a "Unable to Add Accessory" "Accessory is out of compliance" error and the accessory is not added to HomeKit.

I would appreciate any thoughts

@DarylMc
Copy link

DarylMc commented Jun 3, 2024

https://github.com/anthonywebb/homebridge-cbus
Have a read of valid accessory types on the readme page.
Then perhaps post here the config lines for a problematic device.

I'd like to add I'm not very familiar with running Homebridge with CGate 3.2 and you will be one of the first I know of.

@JasonY00
Copy link
Contributor

JasonY00 commented Oct 15, 2024

I just wanted to say that due to necessity and simplification with the EOL of the homebridge-gsh (google voice control plugin) on 1st December 2024, I have managed to get running three c-bus child bridges under the one homebridge installation. Not sure if anyone still interested, but I have three child bridges with 101, 122 and 101 c-bus GA's and sensors all happily working. This means that I can drop my three separate homebridge instances that I was running and there is no problem with the 149 accessories limit in homekit. The config wasn't that bad. Sorry I didn't have time to look earlier. If anyone interested, I can put up sample config.json snippet.

Cheers

Jason

@DarylMc
Copy link

DarylMc commented Oct 15, 2024

@JasonY00
That would be great.
I never got around to trying child bridges

1 similar comment
@DarylMc
Copy link

DarylMc commented Oct 15, 2024

@JasonY00
That would be great.
I never got around to trying child bridges

@SulVento2
Copy link

SulVento2 commented Oct 15, 2024 via email

@malowe1
Copy link

malowe1 commented Oct 16, 2024

@JasonY00 - yes, plenty of interest in the cbus child bridge set-up & your config.json snippet sample.
Please share as much detail as you can 👍

@JasonY00
Copy link
Contributor

JasonY00 commented Oct 16, 2024

Ok. I think it looks ok. I have tested it on a pi running homebridge and a pi running Home Assistant with homebridge run up on the same pi as an add-on. Both work. However, I will note one or two things. I have 326 c-bus devices running very happily with my 3x child bridge config.

Here is the config.json for a c-bus three child bridge configuration. You can do as many as you want i guess...


{
    "bridge": {
        "name": "Homebridge CBus Child Bridges",
        "username": "0E:2C:46:D5:8B:00",
        "port": 46600,
        "pin": "123-45-670",
        "advertiser": "ciao"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "auth": "form",
            "theme": "auto",
            "tempUnits": "c",
            "lang": "auto",
            "platform": "config"
        },
        {
            "name": "CBus",
            "platform_export": "my-platform.json",
            "client_application": 56,
            "client_cbusname": "CBUS_PROJECT_NAME",
            "client_controlport": 20023,
            "client_debug": false,
            "client_ip_address": "127.0.0.1",
            "client_network": 254,
            "accessories": [
                {
                    "type": "dimmer",
                    "network": 254,
                    "application": 56,
                    "id": 1,
                    "name": "Test Dimmer",
                    "enabled": true
                }
            ],
            "platform": "homebridge-cbus.CBus",
            "_bridge": {
                "username": "0E:2C:46:D5:8B:01",
                "port": 46601,
                "pin": "123-45-671"
            }
        },
        {
            "name": "CBus",
            "platform_export": "my-platform.json",
            "client_application": 56,
            "client_cbusname": "CBUS_PROJECT_NAME",
            "client_controlport": 20023,
            "client_debug": false,
            "client_ip_address": "127.0.0.1",
            "client_network": 254,
            "accessories": [
                {
                    "type": "light",
                    "network": 254,
                    "application": 56,
                    "id": 2,
                    "name": "Test Light",
                    "enabled": true
                }
            ],
            "platform": "homebridge-cbus.CBus",
            "_bridge": {
                "username": "0E:2C:46:D5:8B:02",
                "port": 46602,
                "pin": "123-45-672"
            }
        },
        {
            "name": "CBus",
            "platform_export": "my-platform.json",
            "client_application": 56,
            "client_cbusname": "CBUS_PROJECT_NAME",
            "client_controlport": 20023,
            "client_debug": false,
            "client_ip_address": "127.0.0.1",
            "client_network": 254,
            "accessories": [
                {
                    "type": "switch",
                    "network": 254,
                    "application": 56,
                    "id": 3,
                    "name": "Test Switch",
                    "enabled": true
                }
            ],
            "platform": "homebridge-cbus.CBus",
            "_bridge": {
                "username": "0E:2C:46:D5:8B:03",
                "port": 46603,
                "pin": "123-45-673"
            }
        }
    ]
}



Notes:

You CANT CONFIGURE THE CHILD BRIDGE USING THE UI under Plugins, you MUST EDIT EVERYTHING BY HAND in the config.json file under SETTINGS/JSON Config in the UI. So MAKE A COPY OF YOUR CONFIG.JSON FILE SOMEWHERE ELSE JUST IN CASE!!!

My advertiser for homebridge is "ciao" change it to what you are using .i.e. Bonjour HAP etc. However, the documentation recommends Ciao to minimise CPU usage.

The Username can be anything, just all different for the main bridge and each child bridge

The Port can be anything, just all different for the main bridge and each child bridge

You don't need a pin for each child bridge, I added it just to check which child bridge i was adding in the home app as they all appear the same in the home app and the PIN helped me check which child bridge I was adding!

YOU CANNOT change the name of each child bridge they MUST ALL BE "CBus"

YOU CANNOT change the config in homebridge UI, it MUST be done by editing the config.json file

Note your Pairing PIN for each child bridge, because the UI does not generate a QR code for you! When adding the accessory to your iOS device, you need to choose the "More options" selection, look for your advertised child bridge and then type in the PIN.

There may be some redundant definition is each c-bus accessory in my example, but I have a three bridged network and more than one lighting application on my network, so the application and network are important to me! I also did this setup well before the UI was ever around and it isn't broken, so I never bothered to minimise it.

Start your initial setup WITH ONLY ONE accessory per child bridge and check that the child bridges come up, appear in the ACCESSORIES page of the Homebridge UI and that the bridges can be added to the home app.

Potential Strange Behavior I experienced that you might also see:
The first time I tried this setup on my homebridge pi, I couldn't add the child bridge to the home app with more than one c-bus accessory per bridge. With one accessory, it worked, then I just pasted the rest of the c-bus devices into each child bridge in the the config.json file and it was fine. So try it first, or don't, as I may have done something stupid and it may work for you first go!

On my Home Assistant install with the Homebridge Add-On. No matter what I try, I can't see any C-Bus accessories in the ACCESSORIES page of the Homebridge UI! But it all works fine, and I don't really care as I don't use the Homebridge UI. Once again, I may have done something stupid! (Highly likely)

One more note, in the sample config above I have three simple defined accessories of a switch, light and dimmer. So just replace them with three valid C-Bus GA's from your own installation for testing to see if it all works. Also, the IP address is set to 127.0.0.1 as I assume you are running homebridge and c-gate on the same hardware. Change it to the remote host IP if you run c-gate on another box. Change the CBus PROJECT to your PROJECT NAME.

You may also see things appear multiple times in the log. One for ach child bridge to cbus. Each child bridge makes a separate connection to toolkit and each child bridge therefore "sees" the responses from c-gate from every other child bridge. So, my homebridge log is three times the size! I use the homebridge-log-cleaner plugin, to automatically clear my homebridge log every week so it doesn't use all of the space on my pi sd card. It appears as a fan service in homekit. The faster the fan, the bigger the log. When it get to 100%, it turns off, clear the log, starts again at 1% then gets faster over time. It's fun to watch in homekit! More fun that running out of space :-)

I think that's about it... Please let me know if anyone has success (hopefully you won't let me know if you fail)

Also, if you have any questions, just ask!

BTW. Lots of CAPS above. I'm not shouting, they are just the important parts!

Cheers

Jason

@DarylMc
Copy link

DarylMc commented Oct 17, 2024

Thanks Jason
I will have a go at that soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants