How to add it to Home App on iOS
jonathansimmons opened this issue Β· comments
While doing some initial testing I realized that I don't have a code to add the accessory to the Home app on iOS. I used your sample code to create a fan then broadcast, but when trying to add the accessory there was no code.
Am I missing something?
Hey π
The default code / password is 031-45-154.
Thanks
Yea, so I found that in the code about an hour ago but the pairing fails. I'm trying to get back to a computer to try again.
If the pairing continually fails you can reset everything by deleting the files.
- accessory_info.yml
- identifier_cache.yml
Thanks for checking out the project! At the moment it is still mostly just a working prototype but I hope you can get it to pair. I have had it working successfully many times on my test devices. So fingers crossed.
Please let me know how it goes. You might be the first person who has tried to set it up π
Cheers π
So first let me premise that I'm a running current macOS and iOS beta's which does muddy the water some but I've tried this same setup on another laptop running 10.13.5 and got the exact same result. So I don't think it's the OS.
Here are my steps so far:
-
I Downloaded a fresh copy of the repo
-
Ran
bin/setup
thenbin/rubyhome
to use the example file for now.- The Rubyhome Bridge does appear in the manual "add an accessory" section of the Home app on my phone. However, it won't pair. If I use the password you provided it just fails.
-
To better understand, I then booted up a console and re-ran the broadcast this time with logging enabled. Here is what I get:
Start the broadcast
[2018-06-12 08:02:55] INFO WEBrick 1.4.2
[2018-06-12 08:02:55] INFO ruby 2.5.1 (2018-03-29) [x86_64-darwin18]
[2018-06-12 08:02:55] INFO RubyHome::HTTP::HAPServer#start: pid=76696 port=4567
enter the pair code
192.168.7.36 - - [12/Jun/2018:08:03:11 CDT] "POST /pair-setup HTTP/1.1" 200 409
- -> /pair-setup
192.168.7.36 - - [12/Jun/2018:08:03:17 CDT] "POST /pair-setup HTTP/1.1" 200 69
- -> /pair-setup
192.168.7.36 - - [12/Jun/2018:08:03:18 CDT] "POST /pair-setup HTTP/1.1" 200 140
- -> /pair-setup
192.168.7.36 - - [12/Jun/2018:08:03:18 CDT] "POST /pair-verify HTTP/1.1" 200 140
- -> /pair-verify
192.168.7.36 - - [12/Jun/2018:08:03:18 CDT] "POST /pair-verify HTTP/1.1" 200 3
- -> /pair-verify
[2018-06-12 08:03:18] ERROR NoMethodError: undefined method `write' for "":String
/Users/jonathansimmons/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpresponse.rb:298:in `send_header'
/Users/jonathansimmons/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpresponse.rb:210:in `send_response'
/Users/jonathansimmons/Downloads/ruby_home-master/lib/ruby_home/http/hap_response.rb:17:in `send_response'
/Users/jonathansimmons/Downloads/ruby_home-master/lib/ruby_home/http/hap_server.rb:53:in `run'
/Users/jonathansimmons/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/server.rb:307:in `block in start_thread'
- - [12/Jun/2018:08:03:18 CDT] "GET /accessories HTTP/1.1" 200 0
- -> /accessories
Note: After I stop the broadcast I do have to remove the accessory_info.yml
file before restarting or the Bridge won't appear in the Home app. I've not yet had the other .yml file be created.
Thanks very much for that extremely detailed follow up! I am currently on vacation but I will be sure to look into this more as soon as Iβm back.
Cheers π
I have returned from vacation π
I believe I have fixed the issue you experienced if you can test it again that would be greatly appreciated.
Cheers π
Thanks for checking into this. However, even with the revised Sinatra dependency I'm still getting the same error.
Here are my latest logs:
jonathansimmons@Jonathans-MacBook-Pro ~/Downloads/ruby_home-master bin/setup
bundle install
+ bundle install
fatal: not a git repository (or any of the parent directories): .git
Fetching gem metadata from https://rubygems.org/........
Using rake 12.3.1
Using bindata 2.4.3
Using bundler 1.16.2
Using byebug 10.0.2
Using diff-lcs 1.3
Using dnssd 3.0.1
Using ed25519 1.2.4
Using ffi 1.9.25
Using hkdf 0.3.0
Using mustermann 1.0.2
Using oj 3.6.3
Using plist 3.4.0
Using rack 2.0.5
Using rack-protection 2.0.1
Using rack-test 1.0.0
Using rbnacl 5.0.0
Using rbnacl-libsodium 1.0.16
Using rspec-support 3.7.1
Using rspec-core 3.7.1
Using rspec-expectations 3.7.0
Using rspec-mocks 3.7.0
Using rspec 3.7.0
Using srp-rb 1.0.1
Using ruby_home-srp 1.1.1
Using tilt 2.0.8
Fetching sinatra 2.0.1
Installing sinatra 2.0.1
Using wisper 1.6.1
Using x25519 1.0.7
Using ruby_home 0.1.0 from source at `.`
Bundle complete! 7 Gemfile dependencies, 29 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
# Do any other automated setup that you need to do here
jonathansimmons@Jonathans-MacBook-Pro ~/Downloads/ruby_home-master bin/rubyhome
[2018-06-26 19:37:46] INFO WEBrick 1.4.2
[2018-06-26 19:37:46] INFO ruby 2.5.1 (2018-03-29) [x86_64-darwin18]
[2018-06-26 19:37:46] INFO RubyHome::HTTP::HAPServer#start: pid=83903 port=4567
192.168.7.36 - - [26/Jun/2018:19:37:57 CDT] "POST /pair-setup HTTP/1.1" 200 409
- -> /pair-setup
192.168.7.36 - - [26/Jun/2018:19:38:04 CDT] "POST /pair-setup HTTP/1.1" 200 69
- -> /pair-setup
192.168.7.36 - - [26/Jun/2018:19:38:04 CDT] "POST /pair-setup HTTP/1.1" 200 140
- -> /pair-setup
192.168.7.36 - - [26/Jun/2018:19:38:04 CDT] "POST /pair-verify HTTP/1.1" 200 140
- -> /pair-verify
192.168.7.36 - - [26/Jun/2018:19:38:04 CDT] "POST /pair-verify HTTP/1.1" 200 3
- -> /pair-verify
[2018-06-26 19:38:04] ERROR NoMethodError: undefined method `write' for "":String
/Users/jonathansimmons/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpresponse.rb:298:in `send_header'
/Users/jonathansimmons/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpresponse.rb:210:in `send_response'
/Users/jonathansimmons/Downloads/ruby_home-master/lib/ruby_home/http/hap_response.rb:17:in `send_response'
/Users/jonathansimmons/Downloads/ruby_home-master/lib/ruby_home/http/hap_server.rb:53:in `run'
/Users/jonathansimmons/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/server.rb:307:in `block in start_thread'
- - [26/Jun/2018:19:38:04 CDT] "GET /accessories HTTP/1.1" 200 0
- -> /accessories
^C[2018-06-26 19:38:24] INFO going to shutdown ...
[2018-06-26 19:38:24] INFO RubyHome::HTTP::HAPServer#start done.
jonathansimmons@Jonathans-MacBook-Pro ~/Downloads/ruby_home-master gem list sinatra
*** LOCAL GEMS ***
sinatra (2.0.1)
jonathansimmons@Jonathans-MacBook-Pro ~/Downloads/ruby_home-master
You can see I ran setup, started the instance, and still ended up with the error. I had removed all versions of Sinatra, but I listed them at the end to be sure.
This is with Ruby 2.5.0 wonder if that would make a difference somehow?
@jonathansimmons thanks for the ongoing feedback. I am going to install macOS Mojave on a removable USB drive and dual boot my laptop so I can try and reproduce your issue. I will do this soon, hopefully on Monday 2nd July and let you know if I can reproduce the issue.
Iβll try to test it on my 10.12 machine later tonight or tomorrow.
@jonathansimmons I have managed to reproduce your issue on an iPhone running 12.0 and will be testing against a device running 11.4 and 12.0 going forwards.
I will investigate the issue further and get back to you soon.
@jonathansimmons I have managed to successfully pair an iPhone running 12.0. You can see an example here https://youtu.be/ow8m5v4pnXs
So Iβve only ever deleted the yml file. There is no rubyhome instance to remove because itβs never paired before.
@jonathansimmons sorry I edited my original message. I forgot you've never been able to successfully pair π
@jonathansimmons is it possible for you to attempt this again? I've made quite a few changes and added quite a bit more logging to the application since we last spoke.
Hey @jonathansimmons no problem. Congratulations on the new house π
I have same issue.
192.168.0.174 - - [06/Aug/2018:16:55:08 +0900] "POST /pair-setup HTTP/1.1" 200 409 0.1172
192.168.0.174 - - [06/Aug/2018:16:55:16 +0900] "POST /pair-setup HTTP/1.1" 200 6 0.0535
192.168.0.174 - - [06/Aug/2018:16:55:25 +0900] "POST /pair-setup HTTP/1.1" 200 409 0.0995
192.168.0.174 - - [06/Aug/2018:16:55:26 +0900] "POST /pair-setup HTTP/1.1" 200 6 0.0535
and can not pairing...
my accessory_info.yml File...
RubyOns-MacBook-Pro-2:ruby_home rubyon$ cat accessory_info.yml
- :device_id: 33:BE:81:A0:58:9A
:paired_clients: []
:password: 031-45-154
:signature_key: !binary |-
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
π 889cb70edb95f8acb6bd15994163a1
RubyOns-MacBook-Pro-2:ruby_home rubyon$
My Home app said
Couldn't add RubyHome
The setup code is incorrect
@rubyon thanks for sharing. Are you also running the macOS Mojave Beta?
no, just sierra