anthonywebb / homebridge-cbus

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

Raspbian-stretch-lite & Homebridge-Cbus #91

Closed peterconn closed 5 years ago

peterconn commented 5 years ago

Anyone got homebridge for CBUS working with raspbian stretch Lite?

stuck at this step, sudo npm install -g --unsafe-perm homebridge sudo: npm: command not found

Is this because of stretch or newer version of node js 8.11.1

Cheers

Pete

DarylMc commented 5 years ago

Hello Peter I have Homebridge on stretch lite no problem. That looks like a node problem to me. Don’t use my spreadsheet use this. curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs

I think CGate will have some extra work moving from Jessie to Stretch. Previous instructions to start CGate service used init.d and I think that might need to be changed to systemd for Stretch.

peterconn commented 5 years ago

@darylmc thanks mate. I’ll give that a go. Hope you’re keeping well!

DarylMc commented 5 years ago

I have a few RPI’s at home with Homebridge running on Stretch for other plugins. I’ve moved house so nothing with CBus or CGate handy to test right now.

peterconn commented 5 years ago

@DarylMc

wget http://203.41.170.20/downloads/CGate/cgate-2.11.1_3240.zip

This still valid?

DarylMc commented 5 years ago

Just go here, copy the URL for the download and paste with wget in front. Bottom of the page if you want an older cgate version to match a toolkit version.
Check out the matrix chart to make sure all suitable.

https://updates.clipsal.com/ClipsalSoftwareDownload/mainsite/cis/technical/downloads/c-gate.html

peterconn commented 5 years ago

Thanks, i eventually worked it out :-)

DarylMc commented 5 years ago

wget https://updates.clipsal.com/ClipsalSoftwareDownload/mainsite/cis/technical/CGate/cgate-2.11.4_3251.zip

peterconn commented 5 years ago

wget https://updates.clipsal.com/ClipsalSoftwareDownload/mainsite/cis/technical/CGate/cgate-2.11.4_3251.zip

Thanks. :-)

peterconn commented 5 years ago

i think i ran into this issue "CGate will have some extra work moving from Jessie to Stretch. Previous instructions to start CGate service used init.d and I think that might need to be changed to systemd for Stretch."

DarylMc commented 5 years ago

Have a read here. https://blog.addictedtopi.com/2017/05/21/installing-c-gate-on-a-raspberry-pi/

peterconn commented 5 years ago

sudo nano /etc/systemd/system/cgate.service insert text from link sudo systemctl enable cgate.service sudo systemctl start cgate.service sudo chmod +x /usr/local/bin/cgate/cgate.jar sudo chmod 755 /etc/init.d/cgate sudo update-rc.d cgate defaults nano /usr/local/bin/cgate/config/access.txt remote XXX.XXX.XXX.XXX Program sudo service cgate restart

look ok?

DarylMc commented 5 years ago

sudo chmod 755 /etc/init.d/cgate sudo update-rc.d cgate defaults Don’t think you need this since you are moving to systemd

peterconn commented 5 years ago

Ok, thanks. It wouldn’t let me write to nano /usr/local/bin/cgate/config/C-GateConfig.txt Permission denied.

How do I change permission?

DarylMc commented 5 years ago

sudo

peterconn commented 5 years ago

@DarylMc, any thoughts here, homebridge starts and runs for around 20 seconds then stops.

pi@raspberrypi2:~ $ sudo systemctl status homebridge ? homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; disabled) Active: active (running) since Mon 2019-05-13 22:12:36 AEST; 1s ago Main PID: 1241 (homebridge) CGroup: /system.slice/homebridge.service +-1241 homebridge +-1250 /bin/sh -c /bin/echo -n "$(npm -g prefix)/lib/node_modules" +-1251 node /usr/bin/npm -g prefix

May 13 22:12:37 raspberrypi2 nodejs[1241]: WARNING Please fix your application to use the native API of Avahi! May 13 22:12:37 raspberrypi2 nodejs[1241]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs May 13 22:12:37 raspberrypi2 nodejs[1241]: WARNING The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. May 13 22:12:37 raspberrypi2 nodejs[1241]: WARNING Please fix your application to use the native API of Avahi! May 13 22:12:37 raspberrypi2 nodejs[1241]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister May 13 22:12:37 raspberrypi2 homebridge[1241]: WARNING Please fix your application to use the native API of Avahi! May 13 22:12:37 raspberrypi2 homebridge[1241]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs May 13 22:12:37 raspberrypi2 homebridge[1241]: WARNING The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. May 13 22:12:37 raspberrypi2 homebridge[1241]: WARNING Please fix your application to use the native API of Avahi! May 13 22:12:37 raspberrypi2 homebridge[1241]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister

pi@raspberrypi2:~ $ sudo systemctl status homebridge ? homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; disabled) Active: inactive (dead) since Mon 2019-05-13 22:12:40 AEST; 47s ago Process: 1241 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=0/SUCCESS) Main PID: 1241 (code=exited, status=0/SUCCESS)

May 13 22:12:40 raspberrypi2 homebridge[1241]: [5/13/2019, 10:12:40 PM] Loading 1 platforms... May 13 22:12:40 raspberrypi2 homebridge[1241]: [5/13/2019, 10:12:40 PM] [CBus] Initializing homebridge-cbus.CBus platform... May 13 22:12:40 raspberrypi2 homebridge[1241]: Mon, 13 May 2019 12:12:40 GMT cbus:client Opening connection to C-Gate… May 13 22:12:40 raspberrypi2 homebridge[1241]: [5/13/2019, 10:12:40 PM] Loading 0 accessories... May 13 22:12:40 raspberrypi2 homebridge[1241]: Mon, 13 May 2019 12:12:40 GMT cbus:client C-Gate connection open. May 13 22:12:40 raspberrypi2 homebridge[1241]: Mon, 13 May 2019 12:12:40 GMT cbus:client Connected to C-Gate server v2.11.1 (build 3240), syntax v1.0 May 13 22:12:40 raspberrypi2 homebridge[1241]: Mon, 13 May 2019 12:12:40 GMT cbus:client Configuring C-Gate session… May 13 22:12:40 raspberrypi2 homebridge[1241]: Mon, 13 May 2019 12:12:40 GMT cbus:client C-Gate session estabished and configured at 20023:127.0.0.1 May 13 22:12:40 raspberrypi2 homebridge[1241]: Mon, 13 May 2019 12:12:40 GMT cbus:platform Loading the accessories list… May 13 22:12:40 raspberrypi2 homebridge[1241]: Mon, 13 May 2019 12:12:40 GMT cbus:platform Unable to instantiate accessory 'Bathroom Exhaust' (Fan) reason: Error: unknown accessory type 'Fan'. ABORTING

DarylMc commented 5 years ago

@peterconn Hi Peter Just a guess but maybe config.json has a problem. Otherwise maybe both CGate and homebridge starting together causes some problem. To try test that, wait a while after reboot for CGate to sync then stop Homebridge service and restart it. Another thing to test is if project is loaded and running on CGate.

peterconn commented 5 years ago

@peterconn ...

@DarylMc so once I reboot and homebridge timer kicks in, I should force stop homebridge and let cgate start first then start homebridge?

Sent with GitHawk

DarylMc commented 5 years ago

@peterconn I’d try that just to make sure Cgate is started, project loaded and synced before Homebridge tries to talk to it.

If you can wait a few weeks I will try to set up myself and be more able to help

peterconn commented 5 years ago

@DarylMc Can you shed some light on the client control port. With my setup it works with 20023 and also 52497?

"platforms": [{ "platform": "homebridge-cbus.CBus", "name": "CBus", "client_ip_address": "127.0.0.1", "client_controlport": 52497, "client_cbusname": "101SPARK", "client_network": 254, "client_application": 56, "client_debug": true,

    "platform_export": "/home/pi/my-platform.json",
DarylMc commented 5 years ago

{ "bridge": { "name": "My Home", "username": "DC:22:3D:E3:CE:30", "port": 51826, "pin": "031-45-111" },

"description": "This is the My home HomeKit API configuration file.",

"platforms": [ { "platform": "homebridge-cbus.CBus", "name": "CBus", "client_ip_address": "127.0.0.1", "client_controlport": 20023, "client_cbusname": "OFFICE", "client_network": 254, "client_application": 56, "client_debug": true,

  "platform_export": "/home/pi/my-platform.json",

  "accessories": [

  ]
}

], "accessories": [ ] }

DarylMc commented 5 years ago

There is a PDF CGate manual in the C drive of your windows pc after you install Cbus Toolkit. You could search that for the port info. I’ve always used 20023

Use https://jsonlint.com/ to check your config if you haven’t already.

peterconn commented 5 years ago

@darylmc checked and valid.

peterconn commented 5 years ago

@DarylMc

So i got stretch working in my home but cant get it working in my friends. Cgate project has started and running..

bellave

DarylMc commented 5 years ago

That looked alright. Did you sort the problem?

DarylMc commented 5 years ago

Have a read how you can use journalctl I use the following sometimes and you should also be able to see CGate or other services logs too. sudo journalctl -u homebridge.service -f Or try sudo journalctl -u -f

peterconn commented 5 years ago

@darylmc I initially copied my config.json and just edited the addresses to work with my friends system, for some reason it didn’t like that. So I had to manually write all the addresses, types and ID’s in config.json and it worked. I do however get a weird message “lines 1-17/17 (END)” once homebridge has started and I have to hit Ctrl C to view pi@raspberrypi:~$