etwmc / Personal-HomeKit-HAP

This project will provide source code to build a HomeKit support accessories.
MIT License
236 stars 84 forks source link

Use Door, Switch (with more than 1 value) #23

Closed arnauddorgans closed 9 years ago

arnauddorgans commented 9 years ago

hey :) i use lights and switch with this code : http://pastebin.com/rMdVzW3J but i fail to understand how use door/garage door or switch with 5 values for exemple any idea ? :) thx

gb160 commented 9 years ago

I am also struggling with adding different device types....does anyone have a working example of a device which isn't a light or a fan? This would be very useful.

etwmc commented 9 years ago

Check out the PHKAccessory.h enum. I analyze all the available accessory type and listed in the header.

charType_accessoryInfo      = 0x3E,
charType_camera             = 0x3F,
charType_fan                = 0x40,
charType_garageDoorOpener   = 0x41,
charType_lightBulb          = 0x43,
charType_lockManagement     = 0x44,
charType_lockMechanism      = 0x45,
charType_microphone         = 0x46,
charType_outlet             = 0x47,
charType_speaker            = 0x48,
charType_switch             = 0x49,
charType_thermostat         = 0x4A

On Dec 5, 2014, at 16:07, gb160 notifications@github.com wrote:

I am also struggling with adding different device types....does anyone have a working example of a device which isn't a light or a fan? This would be very useful.

— Reply to this email directly or view it on GitHub https://github.com/etwmc/PersonalHomeKit/issues/23#issuecomment-65758704.

etwmc commented 9 years ago

So basically you just need to choose a type, add some service, and you're done Just like the Home Kit Stimulator

arnauddorgans commented 9 years ago

Can you le je look my pastebin http://pastebin.com/rMdVzW3J I try to use garagedoor but don't work.. Compilation is ok but when i start PHK the pairing become impossible :/

etwmc commented 9 years ago

Garage door does not use “on” as type, they use this. (Directly from HomeKit Accessory Simulator) screen shot 2014-12-05 at 19 52 51

gb160 commented 9 years ago

This explains why i was having issues with the thermostat device. Ive successfully got the switch accessory working,I'm guessing the outlet accessory is similar. For reference,is there a list anywhere of which types each accessory uses ? or is the only way of finding this information through using the Accessory Simulator?

Completely separate question, using this dynamic fork, is there a theoretical limit on how many different devices/accessories each bridge can handle? or is this determined by the hardware we are using?

arnauddorgans commented 9 years ago

Where did you find this How can i get this information for switch and door for exemple ? :) So for a garage door we need to set 5 information but how can we ? :/

etwmc commented 9 years ago
  1. Yep, only way is Accessory Simulator. (But if you pay attention, stuff like “on” doesn’t make sense it a door. It should be open/close)
  2. I think currently if you keep the configuration message smaller than 256^2 bytes long, you are safe in this fork. (This is deviated from a one lamp project on MCU, so I need to update the message encrypt method before supporting more) I haven’t test how many you can add in HomeKit structure, but given HAK support cutting and padding message into two or above, I would say the sky is the limit.

    On Dec 5, 2014, at 20:47, gb160 notifications@github.com wrote:

    This explains why i was having issues with the thermostat device. Ive successfully got the switch accessory working,I'm guessing the outlet accessory is similar. For reference,is there a list anywhere of which types each accessory uses ? or is the only way of finding this information through using the Accessory Simulator?

    Completely separate question, using this dynamic fork, is there a theoretical limit on how many different devices/accessories each bridge can handle? or is this determined by the hardware we are using?

    — Reply to this email directly or view it on GitHub https://github.com/etwmc/PersonalHomeKit/issues/23#issuecomment-65785348.

etwmc commented 9 years ago

This is from Hardware Tools in Apple Developer, and you just need to add the service, it will show you the minimum configuration. You can download it as long as you are an Apple developer. (Given you can add HomeKit accessory now, I guess you are one? ) To set the 5 info, instead adding characteristic with type charType_on, use other type. (I listed all available in PHKAccessory.h) If you are wondering what happen when you talk to Siri: the target door state is read+write, and you write there. Other characteristic is from your door. (Or local variable, if you are lazy enough)

On Dec 5, 2014, at 20:49, Arnaud Dorgans notifications@github.com wrote:

Where did you find this How can i get this information for switch and door for exemple ? :) So for a garage door we need to set 5 information but how can we ? :/

— Reply to this email directly or view it on GitHub https://github.com/etwmc/PersonalHomeKit/issues/23#issuecomment-65785563.

arnauddorgans commented 9 years ago

yes i'm an iOS Dev i have access to HomeKit framwork but i don't find the "Hardware Tools" :(

elvisimprsntr commented 9 years ago

Hardware IO Tools

https://developer.apple.com/downloads/index.action

arnauddorgans commented 9 years ago

thank you very much :)

rooi commented 9 years ago

Hi,

I would like to add a speaker and use the output volume as specified as enum. Unfortunately I cannot get it to work. Any ideas why?

etwmc commented 9 years ago

Have you try set the service type to fan It doesn't make sense, but it's the only service type without predefine attributes. (You need to set it up as a set. thermostat has five attributes, light have two) And because Apple doesn't actually publicly declare HomeKit has such function, we don't know what's attribute constitute a speaker. But my guess, speaker would mean remote speaker, so you also need attribute of codec. (Those start with RTCP) But if you want to control the volume only, using fan as attribute is the only way right now.

rooi commented 9 years ago

Thanks! I'll try you suggestions