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

can't use "ph" / error: not a Hue bridge nor deCONZ gateway #383

Closed
paqpaqpaq opened this issue Sep 30, 2018 · 9 comments
Closed

can't use "ph" / error: not a Hue bridge nor deCONZ gateway #383

paqpaqpaq opened this issue Sep 30, 2018 · 9 comments
Labels

Comments

@paqpaqpaq
Copy link

I'm trying to set Osram smart+ plugs as an outlet in Homebridge instead of light bulbs.
However, I can't use
ph outlet -v
In fact, I can't use any ph command.

error:

pi@raspberrypi:~ $ ph outlet -hv
ph: error: localhost: not a Hue bridge nor deCONZ gateway

Since my hue bridge has ip 192.168.1.69:

pi@raspberrypi:~ $ ph -H 192.168.1.69 outlet -v
ph: error: 192.168.1.69: not a Hue bridge nor deCONZ gateway

I can reach 192.168.1.69 browsing or ping.

I'm on a pi3, Raspbian stretch, node 8.12
Any thoughts?

@ebaauw
Copy link
Owner

ebaauw commented Sep 30, 2018

What does ph discover return?

@paqpaqpaq
Copy link
Author

What does ph discover return?

Exact same error

@ebaauw
Copy link
Owner

ebaauw commented Sep 30, 2018

My bad, ph discover wrongly checks for a valid Hue bridge before doing the discovery. That's a bug alright. Although not the cause of your issue.

Could you run DEBUG=* ph -H 192.168.1.69 outlet -v >logfile.txt 2>&1 and attach logfile.txt.

@ebaauw ebaauw added the bug label Sep 30, 2018
@paqpaqpaq
Copy link
Author

@ebaauw

OptionParser0 constructor({"chalk":false,"debug":false,"program":true,"timestamp":false}, false) +0ms
  OptionParser0 boolKey("chalk") +9ms
  OptionParser0 boolKey("debug") +2ms
  OptionParser0 boolKey("program") +0ms
  OptionParser0 boolKey("timestamp") +1ms
  OptionParser0 enumKey("mode") +1ms
  OptionParser0 enumKeyValue("mode", "command") +1ms
  OptionParser0 enumKeyValue("mode", "daemon") +1ms
  OptionParser0 enumKeyValue("mode", "service") +0ms
  OptionParser0 parse({"mode":"command","debug":false}) +1ms
  OptionParser0 parse() => {"chalk":false,"debug":false,"program":true,"timestamp":false} +1ms
  CommandLineParser0 constructor() +0ms
  CommandLineParser0 flag("h", "help") +3ms
  CommandLineParser0 flag("V", "version") +1ms
  CommandLineParser0 option("H", "host") +1ms
  CommandLineParser0 flag("s", "ssl") +1ms
  CommandLineParser0 option("t", "timeout") +0ms
  CommandLineParser0 option("u", "username") +1ms
  CommandLineParser0 parameter("command") +1ms
  CommandLineParser0 remaining() +0ms
  CommandLineParser0 parse(["-H","192.168.1.69","outlet","-v"]) +2ms
  CommandLineParser0 parse() => option: -H 192.168.1.69 +2ms
  CommandLineParser0 parse() => parameter command: outlet +1ms
  CommandLineParser0 parse() => remaining: ["-v"] +1ms
  HueClient1 constructor({"host":"192.168.1.69"}) +0ms
  OptionParser1 constructor({"hostname":"localhost","port":80,"username":"unknown","timeout":5}, false) +0ms
  OptionParser1 hostKey("host", "hostname", "port") +1ms
  OptionParser1 boolKey("ssl") +1ms
  OptionParser1 stringKey("username", true) +0ms
  OptionParser1 intKey("timeout", 1, 60) +1ms
  OptionParser1 parse({"host":"192.168.1.69"}) +1ms
  OptionParser1 parse() => {"hostname":"192.168.1.69","port":80,"username":"unknown","timeout":5} +1ms
  HueClient1 constructor() => {"hostname":"192.168.1.69","port":80,"username":"unknown","timeout":5,"url":"http://192.168.1.69"} +7ms
  HueClient1 getConfig() +1ms
  HueClient1 get("/config") +1ms
  HueClient1 request({"method":"get","url":"http://192.168.1.69/api/config","headers":{"Connection":"keep-alive"},"timeout":5000,"json":true}) +2ms
  HueClient1 request({"method":"get","url":"http://192.168.1.69/api/config","headers":{"Connection":"keep-alive"},"timeout":5000,"json":true}) => undefined +3s
ph: error: 192.168.1.69: not a Hue bridge nor deCONZ gateway

@ebaauw
Copy link
Owner

ebaauw commented Sep 30, 2018

The web server at 192.168.1.69 doesn't return anything, but it seems to take 3 seconds to decide that. Are you sure that's the IP address of your Hue bridge? Are you sure you're connected to the same network? What output does curl http://192.168.1.69/api/config give? What happens if you go to http://192.168.1.69/api/config in your web browser?

@paqpaqpaq
Copy link
Author

paqpaqpaq commented Oct 1, 2018

@ebaauw
I'm so sorry! it was .169, not .69

I now get these outputs:

What output does curl http://192.168.1.69/api/config give?

{"name":"name of hue","datastoreversion":"73","swversion":"1808300701","apiversion":"1.27.0","mac":"00:17:88:25:94:49","bridgeid":"001788FFFE259449","factorynew":false,"replacesbridgeid":null,"modelid":"BSB002","starterkitid":""

What happens if you go to http://192.168.1.169/api/config in your web browser?

{"name":"name of hue","datastoreversion":"73","swversion":"1808300701","apiversion":"1.27.0","mac":"00:17:88:25:94:49","bridgeid":"001788FFFE259449","factorynew":false,"replacesbridgeid":null,"modelid":"BSB002","starterkitid":""}

Now, ph -H 192.168.1.169 outlet -v
ph outlet: error: 1 unauthorized user

@paqpaqpaq
Copy link
Author

paqpaqpaq commented Oct 1, 2018

I managed to create a new API user on the hue bridge

pi@raspberrypi:~ $ ph -H 192.168.1.169 -u ryFGCztx5TyD7kYj2sKc1jo0GTkJqj95JGZ302Nm outlet -v
ph outlet: /resourcelinks/40193: 2 outlets

Getting closer to the solution now?

edit:
I ran the commands again, and I have a clear output now 👍
Thanks for you patience.

Still not sure what causes that I need to specify both host AND user, but it seems to be working now.

@ebaauw
Copy link
Owner

ebaauw commented Oct 1, 2018

If you run ph createuser to create a user, it should save the bridgeid/username to ~/.ph, so you don’t have to specify it. Alternatively, you can set PH_USENAME (and PH_HOST) in the environment.

@paqpaqpaq
Copy link
Author

OK thanks. Running the ph get command with host and user specified, gave me the correct output for the config.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants