anthonywebb / homebridge-cbus

CBus plugin for homebridge
MIT License
35 stars 20 forks source link

Plugin is taking a long time to load #146

Closed SulVento2 closed 4 months ago

SulVento2 commented 4 months ago

My C-Bus system consists of about 60 devices, which relays, dimmers, extra low voltage relays switches and E-DLTs.

There is 5500PCU and a 5500 PACA. These units are connected, via USB, to a Windows 10 computer. IP 192..168.1.4

Homebridge and Homebridge UI are on latest version running on a Raspberry PI3B. IP 192.168.1.11.

This configuration has been running for a number or years without any problems.

The Homebrigde UI reported that a software update was required to all components.

The update stopped Homebrige communicating with C-Gate, which runs on the Windows PC.

I rebuilt the Raspberry Pi from scratch. (Raspbian GNI/Linus Bullseye (11)., and installed Homebridge v18.19.0. I also updated the C-Bus toolkit to V1.17 along with updating the 3 E-DLTs that are used on the C-Bus network.

The PC found all the c-bus devices without any problems. I have since made a change to the C-Bus configuration by adding new device and it's configuration onto the C-Bus network.

This certifies that the Windows 10 , the C-Bus V1.17 UI and C-gate are all working as they should.

I rewrote the config.json file. The new config file complied without any errors.

When I try to run Homebridge I get an error code "Plugin is taking a long time to load"

I would be keen to get some feedback as to my next trouble shooting steps.

DarylMc commented 4 months ago

https://github.com/anthonywebb/homebridge-cbus/issues/140#issuecomment-1872646668

Have a read You will need to rename this for the latest CGate version Or do this https://github.com/anthonywebb/homebridge-cbus/issues/140#issuecomment-1876192871

SulVento2 commented 4 months ago

Hello Daryl, Thanks for your quick response. I couldn't find the CgateConfig file on the Windows computer.

I also had a more detailed look at the Homebridge UI during start up and it would appear the problem is that Homebridge is not allowed to connect to Cgate.

Loading 2 platforms..... [CBUS] Initialising home bridge-cbus.CBus platform... cbus:client Opening connection to C-Gate... cubs.client c-Gate connection Open. cubs.client C-Gate session not ready ..... unexpected message: 412 Connection Refused. cbus.client C-Gate socket terminated. [homebridge-cbus] This plugin is taking long time to load and preventing Homebridge from starting. See https://homebridge.io/w/JtMRG for more info.

I don't mind having the Windows computer running all the time as its doing other tasks.

If I was to migrate C-Gate over to the Raspberry PI how would it connect to the C-Bus network as I don't have a C-Bus interface.

DarylMc commented 4 months ago

It won't work if you don't fix that name problem. Either way will work. file should be here C:\ProgramData\Schneider Electric\C-Gate 3\config\C-GateConfig.txt

DarylMc commented 4 months ago

Screenshot 2024-06-02 at 3 44 10 PM Homebridge is expecting to see "Clipsal C-Gate" not "Schneider Electric C-Gate" Just edit and save.

DarylMc commented 4 months ago

Or edit Homebridge CBus config as described here to change the name from "Clipsal C-Gate" to "Schneider Electric C-Gate" https://github.com/anthonywebb/homebridge-cbus/issues/140#issuecomment-1872646668

sudo nano /var/lib/homebridge/node_modules/homebridge-cbus/lib/cgate-client.js

DarylMc commented 4 months ago

Hello Daryl, Thanks for your quick response. I couldn't find the CgateConfig file on the Windows computer.

I also had a more detailed look at the Homebridge UI during start up and it would appear the problem is that Homebridge is not allowed to connect to Cgate.

Loading 2 platforms..... [CBUS] Initialising home bridge-cbus.CBus platform... cbus:client Opening connection to C-Gate... cubs.client c-Gate connection Open. cubs.client C-Gate session not ready ..... unexpected message: 412 Connection Refused. cbus.client C-Gate socket terminated. [homebridge-cbus] This plugin is taking long time to load and preventing Homebridge from starting. See https://homebridge.io/w/JtMRG for more info.

I don't mind having the Windows computer running all the time as its doing other tasks.

If I was to migrate C-Gate over to the Raspberry PI how would it connect to the C-Bus network as I don't have a C-Bus interface. It should be possible to run CGate on pi I've just never set it up yet for CGate 3.2

SulVento2 commented 4 months ago

Have I mentioned that I hate Windows. I have done the file edit and restarted the toolkit. The application is working as it should and all the C-Bus devices are visible.

I have restarted the Homebridge but I get the same error.

I can ping the Windows computer from the Raspberry PI.

I have attached the json config file json Config.zip

DarylMc commented 4 months ago

OK Did you edit the access.txt file on the Windows PC?

SulVento2 commented 4 months ago

no I just did the C-Gateconfig.txt file

DarylMc commented 4 months ago

CGate will block incoming connections by default You need to edit the access file located "C:\ProgramData\Schneider Electric\C-Gate 3\config\access.txt" eg add the following line Screenshot 2024-06-02 at 4 40 38 PM

SulVento2 commented 4 months ago

I had already thought that adding just the IP of the Pi would be better. After restarting the C-gate service I can now see the IP of the PI in the C-Gate client list.

However I am still getting the same error in Homebridge

SulVento2 commented 4 months ago

Do I still need to edit this file on the PI

sudo nano /var/lib/homebridge/node_modules/homebridge-cbus/lib/cgate-client.js

DarylMc commented 4 months ago

Do I still need to edit this file on the PI

sudo nano /var/lib/homebridge/node_modules/homebridge-cbus/lib/cgate-client.js

No You just need to edit on one or the other

SulVento2 commented 4 months ago

Looking through the Homebridge logs I can see that is still reporting that the cbus.client C-Gate session is still not ready.

unexpected message: 201 Service ready: Schneider Electric C-Gate Version V3.2.0 (Build 1074) #cmd-syntax=1.0

DarylMc commented 4 months ago

OK This indicates you haven't altered the name in cgateconfig .txt

DarylMc commented 4 months ago

change this cgate-name=Schneider Electric C-Gate to cgate-name=Clipsal C-Gate

DarylMc commented 4 months ago

Then restart CGate on your Windows PC

SulVento2 commented 4 months ago

I thought I had done this and check it. But it didn't save.

I have double check it again.

I have restarted homebridge and bingo we have lift off.

Thanks for all your help and patience. You have made an old man very happy.

SulVento2 commented 4 months ago

Good Morning Daryl,

Thanks again for your time yesterday.

I have found another issue with regards to the number of C-Bus groups that I can add to the json file.

I have about 90 groups. Most are devices but some are sub routines in the PACA.

C-Bus doesn't have a problem assigning these to a button in the network and I was hoping to do the same in HomeKit.

It would seem that I cannot list define more than about 40 physical devices in the json file before I get an error message.

"Unable to Add Accessory" Accessory is out of compliance.

If I reduce the devices list in the json file to about 20 I don't get this error message and the devices get mapped into HomeKit

DarylMc commented 4 months ago

No I have never seen that message. 90 group addresses shouldn't cause any problems. Perhaps close this issue and create a new one.

SulVento2 commented 4 months ago

OK I will.

SulVento2 commented 4 months ago

Thanks to Daryl's help this issue is now closed