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

cannot read property 'homepage' of undefined #56

Open
Emptyless opened this issue Jul 28, 2016 · 10 comments
Open

cannot read property 'homepage' of undefined #56

Emptyless opened this issue Jul 28, 2016 · 10 comments

Comments

@Emptyless
Copy link

I am trying to start the Node server from my Macbook but getting this error:

$ npm start -- --name "myOpenHAB-Bridge" --server 10.0.1.15:8080

> [email protected] start ~/OpenHAB-HomeKit-Bridge-1.3.3
> node index.js start "--name" "myOpenHAB-Bridge" "--server" "10.0.1.15:8080"

Starting the bridge myOpenHAB-Bridge ...
~/OpenHAB-HomeKit-Bridge-1.3.3/lib/SitemapParser.js:44
      var widgets = [].concat(sitemap.homepage.widget);
                                     ^

TypeError: Cannot read property 'homepage' of undefined
    at SitemapParser.parseSitemap (SitemapParser.js:25:29)
    at openHABBridge.js:59:39
    at Request._callback (RestClient.js:28:11)
    at Request.self.callback (~/OpenHAB-HomeKit-Bridge-1.3.3/node_modules/request/request.js:187:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (~/OpenHAB-HomeKit-Bridge-1.3.3/node_modules/request/request.js:1044:10)
    at emitOne (events.js:77:13)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (~/OpenHAB-HomeKit-Bridge-1.3.3/node_modules/request/request.js:965:12)

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" "--" "--name" "myOpenHAB-Bridge" "--server" "10.0.1.15:8080"
npm ERR! node v5.1.0
npm ERR! npm  v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node index.js start "--name" "myOpenHAB-Bridge" "--server" "10.0.1.15:8080"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'node index.js start "--name" "myOpenHAB-Bridge" "--server" "10.0.1.15:8080"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the openHAB-HomeKit-Bridge package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node index.js start "--name" "myOpenHAB-Bridge" "--server" "10.0.1.15:8080"
npm ERR! You can get their info via:
npm ERR!     npm owner ls openHAB-HomeKit-Bridge
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!    ~/OpenHAB-HomeKit-Bridge-1.3.3/npm-debug.log
@FluBBaOfWard
Copy link

Since you're not specifying a sitemap, have you set up a site map named "homekit.sitemap"?

@Emptyless
Copy link
Author

yes in the same directory as the default.sitemap. I did try to add it by appending "--sitemap" "homekit" but that yielded the same results

@FluBBaOfWard
Copy link

Can you open http://10.0.1.15:8080/rest/sitemaps/homekit in a web browser?

@Emptyless
Copy link
Author

Yes i can, I was also experimenting with Homebridge and there the sitemap works. No items are in groups or frames. Everything is added like the description on this repo's README.md

@FluBBaOfWard
Copy link

I'm not sure I remember right, but I don't think I could use # for comments in the sitemap if you have copied from the example.

@Emptyless
Copy link
Author

I will test if it starts without the #'s, will post results

@htreu
Copy link
Owner

htreu commented Aug 23, 2016

Did the comments have any effect? Please post your sitemap if the problem still exists.

@niwakame
Copy link

Your problem is most likely having set up a username and password. Try to use "user:[email protected]:8080". Otherwise, sitemap download will fail, because of basic auth.

@yi959
Copy link

yi959 commented Jan 8, 2017

I'm experiencing the same error:

sudo npm start -- --name "myOpenHAB-Bridge" --server 192.168.1.101:8080

> [email protected] start /opt/openhab/OpenHAB-HomeKit-Bridge
> node index.js start "--name" "myOpenHAB-Bridge" "--server" "192.168.1.101:8080"

*** 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>
Starting the bridge myOpenHAB-Bridge ...
/opt/openhab/OpenHAB-HomeKit-Bridge/lib/SitemapParser.js:44
      var widgets = [].concat(sitemap.homepage.widget);
                                     ^

TypeError: Cannot read property 'homepage' of undefined
    at SitemapParser.parseSitemap (/opt/openhab/OpenHAB-HomeKit-Bridge/lib/SitemapParser.js:25:29)
    at /opt/openhab/OpenHAB-HomeKit-Bridge/lib/openHABBridge.js:59:39
    at Request._callback (/opt/openhab/OpenHAB-HomeKit-Bridge/lib/RestClient.js:28:11)
    at Request.self.callback (/opt/openhab/OpenHAB-HomeKit-Bridge/node_modules/request/request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/opt/openhab/OpenHAB-HomeKit-Bridge/node_modules/request/request.js:1081:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/opt/openhab/OpenHAB-HomeKit-Bridge/node_modules/request/request.js:1001:12)

npm ERR! Linux 4.4.0-57-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start" "--" "--name" "myOpenHAB-Bridge" "--server" "192.168.1.101:8080"
npm ERR! node v7.4.0
npm ERR! npm  v4.1.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node index.js start "--name" "myOpenHAB-Bridge" "--server" "192.168.1.101:8080"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'node index.js start "--name" "myOpenHAB-Bridge" "--server" "192.168.1.101:8080"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the openHAB-HomeKit-Bridge package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node index.js start "--name" "myOpenHAB-Bridge" "--server" "192.168.1.101:8080"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs openHAB-HomeKit-Bridge
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls openHAB-HomeKit-Bridge
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /opt/openhab/OpenHAB-HomeKit-Bridge/npm-debug.log

I've set a default.sitemap as below:

sitemap homekit label="NekkoYi HomeKit" {
  Switch item=bal label="陽台"
  Switch item=bath label="浴室"
  Switch item=bed label="主臥"
  Switch item=dine label="餐桌"
  Switch item=ent label="玄關"
  Switch item=guest label="和室"
  Switch item=kit label="廚房"
  Switch item=storage label="儲藏室"
  Switch item=study label="書房"
  Switch item=liv label="客廳"
}

Also I tried the method @niwakame suggested, didn't male any difference.

And I cannot open/rest/sitemaps/default , it gave me this:

HTTP ERROR 500

Problem accessing /rest/sitemaps/homekit. Reason:

    javax.servlet.ServletException: Throwable
...
...
...

but just http://192.168.1.101:8080/ works fine and redirects to http://192.168.1.101:8080/openhab.app

I have another bridge running just fine with the same config, not sure why this happened.
Any help will be greatly appreciated.

@yi959
Copy link

yi959 commented Jan 8, 2017

It turned out to be caused by java. After manually killed the java and openhab process then restart openhab, the REST API became reachable, and the bridge worked fine! Took me an hour to figure out though... silly me 😂

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