snowdd1 / homebridge-knx

KNX platform shim for homebridge
https://github.com/nfarina/homebridge
GNU General Public License v2.0
97 stars 55 forks source link

0 accessories #27

Closed cece99 closed 8 years ago

cece99 commented 8 years ago

If I try to run homebridge I get 0 accessories found:

`pi@raspberrypi:~/.homebridge $ homebridge * WARNING * The program 'node' uses the Apple Bonjour compatibility layer of Avahi. * WARNING * Please fix your application to use the native API of Avahi! * WARNING * For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node * WARNING * The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. * WARNING * Please fix your application to use the native API of Avahi! * WARNING * For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister [3/13/2016, 3:12:39 PM] Loaded plugin: homebridge-knx [3/13/2016, 3:12:39 PM] Registering platform 'homebridge-knx.KNX' [3/13/2016, 3:12:39 PM] --- [3/13/2016, 3:12:39 PM] Loaded config.json with 0 accessories and 1 platforms. [3/13/2016, 3:12:39 PM] --- [3/13/2016, 3:12:39 PM] Loading 1 platforms... [3/13/2016, 3:12:39 PM] [KNX] Initializing KNX platform... [3/13/2016, 3:12:39 PM] [KNX] Fetching KNX devices. [3/13/2016, 3:12:39 PM] [KNX] returning 0 accessories Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

┌────────────┐     
│ 031-45-154 │     
└────────────┘     

[3/13/2016, 3:12:39 PM] Homebridge is running on port 51826.`

And I'm running knxd this way: pi@raspberrypi:~ $ sudo knxd --eibaddr=0.0.100:6720 --error=1 --listen-local=/var/run/knxd --pid-file=/var/run/knxd.pid --layer2=usb:1:4 W00000020: EIBD should not run as root

I'm also providing the config.json: `{

"bridge": { 

    "name": "Homebridge", 

    "username": "CA:22:3E:E3:CE:30", 

    "port": 51826, 

    "pin": "031-45-154"

 }, 

"platforms": [ 

    { 

        "platform": "KNX", 

        "name": "KNX", 

        "knxd_ip": “0.0.100”, 

        "knxd_port": 6720, 

        "knxd_do_not_read_set_groups": true, 

        "hint_knxd_do_not_read_set_groups": "true if homebridge must not send read requests to Set addresses", 

        "accessories": [ 

            { 

                "description": "sample device with multiple services. Multiple services of different types are widely supported", 

                "name": "Office", 

                "services": [ 

                    { 

                        "type": "Lightbulb", 

                        "name": "Office Lamp", 

                        "On": { 

                            "Set": "1/3/5"

                         }

                     }

         ]

     }

 ], 

"accessories": [ 

 ]

}

]

}`

I don't know what I'm doing wrong, I have a "TheBen" USB to KNX interface.

Thanks for the help.

snowdd1 commented 8 years ago

I cannot see any error in your config.json - except the strange quotes around "knxd_ip": “0.0.100” Try to exchange those quotes with normal quotes - your editor might have replaced while typing. It's always best to use a plain text editor instead of a "smart" program (like MS Word, Write, you-name-it)

cece99 commented 8 years ago

I fixed the problem with the quotes but it's still not working, same problem. Should I try with eibd?

snowdd1 commented 8 years ago

Which version of Homebridge are you using? I do not think that knxd/eibd are doing any harm at the moment (though I think it wouldn't work see below) , for some reason your accessory does not get read:

[3/13/2016, 3:12:39 PM] [KNX] Initializing KNX platform...
[3/13/2016, 3:12:39 PM] [KNX] Fetching KNX devices.
[3/13/2016, 3:12:39 PM] [KNX] returning 0 accessories

It should return 1 accessory, not 0. I am not sure it actually reads the config.json you've pasted, do you might have more than one?

Your knxd parameters are a little mixed up. --eibaddr=0.0.100 doe not mean IP address 0.0.100 but KNX (physical) address of 0.0.100. For defining an IP listener, use --listen-tcp=192.168.0.1 or whatever your local network range suits.

See https://gist.github.com/snowdd1/0ecceb38e924ee125d36#local-listener-section for more details.

cece99 commented 8 years ago

I only have a single config.json.

I'm using an USB to KNX controller, so I guess that --eibaddr=0.0.100 is not needed. I think that I'm messing up the knxd parameters, I cannot understand which ip address and port should I put on the config.json file. Can you help me out with this?

snowdd1 commented 8 years ago

Hi @cece99 I just re-installed my RaspberryPi with a fresh raspbian jessie lite. I failed to run Homebridge with node v5, so I went for 4.4 again.

Which version are you using?

I used to following commands for installation:

Setup nodejs

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install nodejs

Setup Homebridge (not as global package but local to user pi)

$ npm install homebridge
....
$ npm install homebridge-knx
homebridge-knx@0.2.7 node_modules/homebridge-knx
├── eibd@0.3.4
└── hapi@13.2.1 (cryptiles@3.0.0, ammo@2.0.0, kilt@2.0.0, items@2.0.0, peekaboo@2.0.0, catbox-memory@2.0.1, topo@2.0.0, iron@4.0.0, boom@3.1.2, call@3.0.0, shot@3.0.1, hoek@3.0.4, accept@2.1.0, mimos@3.0.0, subtext@4.0.0, joi@8.0.4, statehood@4.0.0, heavy@4.0.0, catbox@7.1.0)

I ran homebridge once to create the .homebridge directory in pi's home:

pi@homebridge-dev:~ $ DEBUG=* ./node_modules/homebridge/bin/homebridge -D 
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs>
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister>
2016-03-16 20:44:36] Loaded plugin: homebridge-knx
[2016-03-16 20:44:36] Registering platform 'homebridge-knx.KNX'
[2016-03-16 20:44:36] ---
Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

    ┌────────────┐
    │ 031-45-154 │
    └────────────┘

  Accessory [Homebridge] Creating new AccessoryInfo for our HAP server +0ms
  Accessory [Homebridge] Creating new IdentifierCache +18ms
[2016-03-16 20:44:36] Homebridge is running on port 51826.
  EventedHTTPServer Server listening on port 51826 +77ms
^C[2016-03-16 20:44:56] Got SIGINT, shutting down Homebridge...

Pressed ctrl-cto kill it again, copied my old config.json to ~/.homebridge (with filezilla).

After restarting homebridge with the same command as above, all my accessories came back.

pi@homebridge-dev:~ $ DEBUG=* ./node_modules/homebridge/bin/homebridge -D
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs>
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister>
[2016-03-16 20:48:27] Loaded plugin: homebridge-knx
[2016-03-16 20:48:27] Registering platform 'homebridge-knx.KNX'
[2016-03-16 20:48:27] ---
[2016-03-16 20:48:27] Loaded config.json with 0 accessories and 1 platforms.
[2016-03-16 20:48:27] ---
[2016-03-16 20:48:27] Loading 1 platforms...
[2016-03-16 20:48:27] [KNX] Initializing KNX platform...
[2016-03-16 20:48:27] [KNX] Fetching KNX devices.
[2016-03-16 20:48:27] [KNX] parsing acc 0 of 27
[2016-03-16 20:48:27] [KNX] push new device Bewegung Treppe DG
[2016-03-16 20:48:27] [KNX] Accessory constructor called
[2016-03-16 20:48:27] [KNX] created Bewegung Treppe DG accessory
[2016-03-16 20:48:27] [KNX] parsing acc 1 of 27
[2016-03-16 20:48:27] [KNX] push new device Bewegung Treppe OG
[2016-03-16 20:48:27] [KNX] Accessory constructor called
[2016-03-16 20:48:27] [KNX] created Bewegung Treppe OG accessory
[2016-03-16 20:48:27] [KNX] parsing acc 2 of 27

...

Maybe you should consider re-installing node, homebridge and homebridge-knx on your pi. For some reason homebridge never passes the accessories section to homebridge-knx in your current installation. It never comes to a point talking to knxd, so that cannot be a factor.

Best regards Raoul

snowdd1 commented 8 years ago

This is stale for 10 days, so I assume it solved.