karlentwistle / ruby_home

Ruby HAP Server - HomeKit support for the Rubyist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't use services other than Fan

vickash opened this issue · comments

Hi,

I got the basic fan example working properly and then tried changing the fan to a garage door opener with:

door = RubyHome::AccessoryFactory.create(:garage_door_opener)

door.characteristic(:target_door_state).on(:updated) do |new_value|
  puts new_value.inspect
end

I deleted the bridge from my phone, and the YAML file from my working directory, before running the script again. The bridge shows in the Home app, but after entering the code, I get the error message:

Couldn't add RubyHome
Home couldn't connect to this accessory.

If, instead of replacing the fan with a garage door opener, I add a second fan to the example, both fans show up and work properly in the Home app.

I'm using ruby 2.5.0p0 on OS X 10.11.6 (El Capitan) and iOS 11.4.1 if that helps. Thanks.

Hi @vickash

Thanks very much for bringing this issue to my attention.

I had a bit of time tonight to fix the immediate issue #33 and was able to successfully get through the pairing process for a garage_door_opener.

require 'ruby_home'

accessory_information = RubyHome::AccessoryFactory.create(:accessory_information)
door = RubyHome::AccessoryFactory.create(:garage_door_opener)

door.characteristic(:target_door_state).on(:updated) do |new_value|
  puts new_value.inspect
end

RubyHome.run

I am impressed you managed to figure out how to create the accessory by digging around the code 😄
I probably need to update the documentation a bit with some more examples to make it easier to figure out.

Unfortunately once successfully paired there is another issue when attempting to interact with the garage_door_opener. I think the CharacteristicsController might need some tweaking to support the fetching of multiple characteristics at once.

I can see my test iOS device is requesting multiple characteristics.

GET /characteristics?id=2.11,2.9,2.10

The fan example only requests one characteristic.

GET /characteristics?id=2.11

I will fix this next. Feel free to take a look yourself if you're still interested.

Cheers

@vickash I have fixed the setting e673699 and getting 79b67c9 of characteristics.

The final issue I am aware of that you will probably run into is #34 I will fix this is due course.

Cheers