KraigM / homebridge-harmonyhub

HomeBridge Plugin for Logitech Harmony Hub
181 stars 52 forks source link

config.json problems? #60

Open PaMo23 opened 7 years ago

PaMo23 commented 7 years ago

Hi guys. I am a absolute rookie of that issue. I want to use the Logitech Harmony Hub with Homebridge that I am able to use Apple's HomeKit like explained.

Let me tell you what I have done so far:

But what I have to do now? How do I finish that installation process? When can I plug off the USB? How does look like a finished config.json file? Do you have an example? Would I find the Logitech Harmony Hub itself in my Apple HomeKit app or just the accessories which I have to add in the config.json file?

Thank you so much for your support and help. I really appreciate every single information. Paul ✌🏻️

ewgor commented 7 years ago

Dude I see nobody answered you, I have the same problem but with the config.json file. I don't know how to fill in more platforms as for example I'm running openhab and homebridge on a raspberry pi and without Harmony plugin works great but when I try to add the harmony platform in the config.js it simply won't start the bridge! I don't know how to config the hub because I have both the remote and the hub and I configured my Logitech using the remote but I think the same process is for the hub too! After you make the hub configuration with Logitech app you can unplug the USB from your mac and plugin on the power socket. Than you have to install the homebridge on your mac and the harmony plugin too. At least, you come to the same problem as mine, how to set the config.json file. In my case, the problem is that on the same file I have the openhab platform which works but not together with the harmony! I don't know what to say, I couldn't find any clear instruction about this by now. Maybe some guys here can help us .

Spybyte commented 7 years ago

Hi, This is a minimum config.json file for homebridge with harmony hub. If your pi and the harmony hub are on the same network the plugin should find your hub.

Unplug the hub from USB and just start homebridge.

{ "bridge": { "name": "Homebridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "031-45-154" },

"description": "This is an example configuration file with one fake accessory and one fake platform. You can use this as a template for creating your own configuration file containing devices you actually own.",

"platforms": [{
    "platform": "HarmonyHub",
    "name": "Harmony Hub"
}]

}

ewgor commented 7 years ago

Hi, @Spybyte do you know how can i add multiple platforms on the same config.json file? This is what I have: { "bridge": { "name": "Homebridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "031-45-154" },

"description": "This is an example configuration file with one fake accessory and one fake platform. You can use this as a template for creating your own configuration file containing devices you actually own.",

"accessories": [
 ],

"platforms": [
{
    "platform": "openHAB",
    "name": "openHAB",
    "host": "192.168.1.110",
    "port": "8080",
    "sitemap": "default",
    "useLabelForName": true
 }

] } If I try to add another platform, this configuration will crack! Thanks.

Spybyte commented 7 years ago

Yes, do the following:

{ "bridge": { "name": "Homebridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "031-45-154" },

"description": "This is an example configuration file with one fake accessory and one fake platform. You can use this as a template for creating your own configuration file containing devices you actually own.",

"accessories": [ ],

"platforms": [ { "platform": "openHAB", "name": "openHAB", "host": "192.168.1.110", "port": "8080", "sitemap": "default", "useLabelForName": true }, { "platform": "HarmonyHub", "name": "Harmony Hub" } ] }

ewgor commented 7 years ago

Man I did already this and the bridge starts, it finds the OH items but than I get this error: TypeError: Cannot read property 'identity' of undefined. Here bellow you can see the logs. Sorry for this long post.

Logs: pi@raspberrypi:~ $ homebridge * 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 [10/31/2016, 10:38:00 AM] Loaded plugin: homebridge-harmonyhub [10/31/2016, 10:38:03 AM] Registering platform 'homebridge-harmonyhub.HarmonyHub' [10/31/2016, 10:38:03 AM] --- [10/31/2016, 10:38:05 AM] Loaded plugin: homebridge-openhab [10/31/2016, 10:38:05 AM] Registering platform 'homebridge-openhab.openHAB' [10/31/2016, 10:38:05 AM] --- [10/31/2016, 10:38:05 AM] Loaded config.json with 0 accessories and 2 platforms. [10/31/2016, 10:38:05 AM] --- [10/31/2016, 10:38:05 AM] Loading 2 platforms... [10/31/2016, 10:38:05 AM] [openHAB] Initializing openHAB platform... [10/31/2016, 10:38:05 AM] [openHAB] Platform - Fetching OpenHAB devices. [10/31/2016, 10:38:05 AM] [openHAB] Platform - Connecting to http://192.168.1.110:8080/rest/sitemaps/default?type=json [10/31/2016, 10:38:05 AM] [Harmony Hub] Initializing HarmonyHub platform... [10/31/2016, 10:38:05 AM] Loading 0 accessories... [10/31/2016, 10:38:06 AM] [openHAB] Platform - The widget 'Senzori' of type GroupItem is an item not handled. [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Temperature [25.0 °C] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Humidity [35.0 %] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Light Intensity [0 %] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Mooving Senosor [ATENTIE miscare] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Front Door [OPEN] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Status Contacte Deschise [2] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Back Door [OPEN] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Bedroom window [CLOSED] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Yala Usa Acces [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Switch ON/OFF Living [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Dimmer Living [0 %] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Consum curent iluminat Living [00.0 W] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Consum total iluminat Living [29.14 kWh] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Cost iluminat [- LEI] [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Scena [10/31/2016, 10:38:06 AM] [openHAB] Platform - The widget 'Scena Activa [PowerOff]' of type StringItem is an item not handled. [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: First light [10/31/2016, 10:38:06 AM] [openHAB] Platform - Accessory Found: Second light [10/31/2016, 10:38:06 AM] [openHAB] Platform - The widget 'All Off' of type GroupItem is an item not handled. [10/31/2016, 10:38:06 AM] [openHAB] Platform - The widget 'TempHum' of type GroupItem is an item not handled. [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Temperature [25.0 °C]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Humidity [35.0 %]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Light Intensity [0 %]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Mooving Senosor [ATENTIE miscare]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Front Door [OPEN]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Status Contacte Deschise [2]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Back Door [OPEN]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Bedroom window [CLOSED]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Yala Usa Acces'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Switch ON/OFF Living'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Dimmer Living [0 %]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Consum curent iluminat Living [00.0 W]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Consum total iluminat Living [29.14 kWh]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Cost iluminat [- LEI]'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Scena'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'First light'... [10/31/2016, 10:38:06 AM] [openHAB] Initializing platform accessory 'Second light'... Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

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

[10/31/2016, 10:38:07 AM] Homebridge is running on port 51826. [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Humidity [35.0 %] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Light Intensity [0 %] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Temperature [25.0 °C] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Back Door [OPEN] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for First light [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Status Contacte Deschise [2] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Switch ON/OFF Living [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Mooving Senosor [ATENTIE miscare] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Cost iluminat [- LEI] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Dimmer Living [0 %] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Bedroom window [CLOSED] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Consum total iluminat Living [29.14 kWh] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Consum curent iluminat Living [00.0 W] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Front Door [OPEN] [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Scena [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Yala Usa Acces [10/31/2016, 10:38:07 AM] [openHAB] OpenHAB WS - new connection for Second light /usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/lib/login/hub.js:59 if (response.identity && response.identity !== undefined) { ^

TypeError: Cannot read property 'identity' of undefined at Client. (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/lib/login/hub.js:59:19) at emitOne (events.js:77:13) at Client.emit (events.js:169:7) at Client._handleStanza (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/lib/Client.js:227:12) at Client.onStanza (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/lib/Client.js:221:8) at emitOne (events.js:77:13) at Connection.emit (events.js:169:7) at Connection.onStanza (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/node_modules/node-xmpp-core/lib/Connection.js:377:10) at StreamParser. (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/node_modules/node-xmpp-core/lib/Connection.js:231:10) at emitOne (events.js:77:13) at StreamParser.emit (events.js:169:7) at SaxLtx. (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/node_modules/node-xmpp-core/node_modules/@xmpp/streamparser/index.js:59:14) at emitOne (events.js:77:13) at SaxLtx.emit (events.js:169:7) at SaxLtx._handleTagOpening (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/node_modules/node-xmpp-core/node_modules/@xmpp/streamparser/node_modules/ltx/lib/parsers/ltx.js:36:12) at SaxLtx.write (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/node_modules/node-xmpp-core/node_modules/@xmpp/streamparser/node_modules/ltx/lib/parsers/ltx.js:96:18) pi@raspberrypi:~ $

Thanks.

Spybyte commented 7 years ago

See this posting from the harmonyhubjs-client. Did you install the lastest version? Was fixed 6 days ago.

ewgor commented 7 years ago

Hi, I asked for help here too. I followed "@lanzer I'm not sure why. Make sure you rm -Rf node_modules and re run npm install." and i get this errors trying to reinstall npm:

pi@raspberrypi:~ $ sudo rm -Rf node_modules
pi@raspberrypi:~ $ sudo npm install
npm ERR! install Couldn't read dependencies
npm ERR! Linux 4.4.21-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.6.0
npm ERR! npm  v2.15.9
npm ERR! path /home/pi/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2
npm ERR! syscall open

npm ERR! package.json ENOENT: no such file or directory, open '/home/pi/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/npm-debug.log

Could You please help? Thanks.

Spybyte commented 7 years ago

Try this: npm install -g npm See also: http://stackoverflow.com/questions/27637642/npm-throws-error-couldnt-read-dependencies

Maybe you should consider running homebridge and its plugins in a docker container on the pi. I always had trouble with nodejs and different apps. So I decided to let them run in a container. I use a nodejs image and on top of this a pre defined homebridge image. On top of this I add my plugins. my config.json resides on my pi.

ewgor commented 7 years ago

Yep, I think using npm install -g npm it worked, it returns:

/usr/bi/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js
npm@3.10.9 /usr/lib/node_modules/npm

but than again starting homebridge i get the same error:

TypeError: Cannot read property 'identity' of undefined
at Client. (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/lib/login/hub.js:59:19)
at emitOne (events.js:77:13)
at Client.emit (events.js:169:7)
at Client._handleStanza (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/lib/Client.js:227:12)
at Client.onStanza (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/lib/Client.js:221:8)
at emitOne (events.js:77:13)
at Connection.emit (events.js:169:7)
at Connection.onStanza (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/node_modules/node-xmpp-core/lib/Connection.js:377:10)
at StreamParser. (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/node_modules/node-xmpp-core/lib/Connection.js:231:10)
at emitOne (events.js:77:13)
at StreamParser.emit (events.js:169:7)
at SaxLtx. (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/node_modules/node-xmpp-core/node_modules/@xmpp/streamparser/index.js:59:14)
at emitOne (events.js:77:13)
at SaxLtx.emit (events.js:169:7)
at SaxLtx._handleTagOpening (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/node_modules/node-xmpp-core/node_modules/@xmpp/streamparser/node_modules/ltx/lib/parsers/ltx.js:36:12)
at SaxLtx.write (/usr/lib/node_modules/homebridge-harmonyhub/node_modules/harmonyhubjs-client/node_modules/node-xmpp-client/node_modules/node-xmpp-core/node_modules/@xmpp/streamparser/node_modules/ltx/lib/parsers/ltx.js:96:18)

what could it be?

Spybyte commented 7 years ago

Did you reinstall homebridge-harmonyhub? Maybe a clean install helps. Thats what I always did when nothing else helped. Nevertheless this is a question related to harmonyhubjs-client. Consider asking this question there. Maybe they can help.

ewgor commented 7 years ago

Thanks man, I got it working after installing the plugin again. What do you mean by running the homebridge and the plugin in a docker container on the pi? could you point me a good tutorial of this?

Thanks again for the help!