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

async function getRequestToken #1

Open
kennhardy opened this issue Oct 22, 2017 · 11 comments
Open

async function getRequestToken #1

kennhardy opened this issue Oct 22, 2017 · 11 comments

Comments

@kennhardy
Copy link

Hi. Just tried the following command and falled upon an error straight away.

kennhard@home:~/.homebridge$ telldus-local-auth 192.168.0.26 homebridge-telldus
/usr/lib/node_modules/telldus-local-auth/telldus-local-auth.js:32
async function getRequestToken() {
      ^^^^^^^^

SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)

Some information:

kennhard@home:~/.homebridge$ node -v
v6.11.3
kennhard@home:~/.homebridge$ sudo npm install -g node-v8-version
/usr/bin/v8v -> /usr/lib/node_modules/node-v8-version/v8v
+ [email protected]

Any suggestions?

@mifi
Copy link
Owner

mifi commented Oct 22, 2017

Hi. If you see the README it says that it requires node 8.

@kennhardy
Copy link
Author

Oh, now I feel stupid. I thought I already had upgraded to node 8. Must have missed something. My mistake! Works like a charm now:

kennhard@home:~/.homebridge$ telldus-local-auth 192.168.0.26 homebridge-telldus
Go to http://192.168.0.26/api/authorize?token=<TOKEN>
Login to your Telldus Live account
Important! Select 1 year and Auto renew access
Then press Authorize and come back here when done

Thank you. Keep up the good work!

@mifi
Copy link
Owner

mifi commented Oct 22, 2017

Cool. Would be cool to know if you get local support to work also!

@kennhardy
Copy link
Author

Yes. Ill keep you posted. Right now I have a minor problem with the authorisation process. After invoking the process as detailed in my prior post I go to the url and get this:

TellStick ZNet

Menu

You tried to log in as [email protected] but this TellStick ZNet is activated to

© 2016 Telldus Technologies AB

Not sure if this is due to a bug in telldus or a uploaded script from the telldus-local-auth? The url it refers me to after login is (PS! all ID's and similar to tokens are scrambled):
http://192.168.0.26/tellduslive/authorize?janrain_nonce=2017-10-22T15:48:48ZZvCGke&openid.assoc_handle={HMAC-SHA1}{59ecbb4c}{ioSkgQ==}&openid.claimed_id=http://login.telldus.com/id?i=6183&h=f191252effc4c42369b02325faa401f8s8418b31e0&openid.identity=http://login.telldus.com/id?i=6183&h=f191252effc4c42369b02325faa401f8s8418b31e0&openid.mode=id_res&openid.ns=http://specs.openid.net/auth/2.0&openid.ns.sreg=http://openid.net/extensions/sreg/1.1&openid.op_endpoint=http://login.telldus.com/openid/server&openid.response_nonce=2017-10-22T15:48:42Ze6fzT8&openid.return_to=http://192.168.0.26/tellduslive/authorize?janrain_nonce=2017-10-22T15%3A48%3A48ZZvCGke&openid.sig=12xUwhuQshfvl/BC9fK56743w8Y=&openid.signed=assoc_handle,claimed_id,identity,mode,ns,ns.sreg,op_endpoint,response_nonce,return_to,signed,sreg.email,sreg.fullname&[email protected]&openid.sreg.fullname=My+Name

@kennhardy kennhardy reopened this Oct 22, 2017
@kennhardy
Copy link
Author

Main issue now is despite clearing cache or trying to restart device I'm still logged in. The details in the url and "[email protected]" stated on the website are correct. Same as I use to log in to live.telldus page.

@mifi
Copy link
Owner

mifi commented Oct 22, 2017

Did you try incognito window? Also which version of tellstick do you have? I have a tellstick znet lite v1 and it's working fine

@kennhardy
Copy link
Author

Yes, incognito throws be back to the login page but straight back to the same after login. Tried manual and going through the google signin just to be sure. I have the znet v2. Could that be the cause?

@mifi
Copy link
Owner

mifi commented Oct 22, 2017

maybe something is different on ZNet v2 (not lite?)

It's hard for me to know whats wrong with your device. Maybe you can try the procedure from Telldus's homepage, and see where it fails:

http://api.telldus.net/localapi/api/authentication.html

(this is the same procedure as telldus-local-auth is doing)

@mifi
Copy link
Owner

mifi commented Oct 22, 2017

According to their web page ZNet v2 is supposed to be supported:

This is the documentation for the local API in TellStick Net v2 and TellStick ZNet Lite v1/v2. This documentation also covers Lua-scripting and Plugins
http://developer.telldus.com/

EDIT: Oh wait, NET v2, not ZNet 2. maybe contact them and ask them.

@kennhardy
Copy link
Author

Got it working by requesting a token the manual way. Everything works perfectly. Only got some minor problems with homebridge after upgrade, but thats unrelated. Much faster and much better! Will try the statuses and everything further on. thank you very much!

@mifi
Copy link
Owner

mifi commented Oct 22, 2017

That's strange. Maybe you clicked the link in addition to it auto-opening, and then got 2 login requests at the same time which bugged something out on the device?

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

2 participants