ruby_home 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.hound.yml +2 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +9 -0
  6. data/.travis.yml +21 -0
  7. data/Gemfile +6 -0
  8. data/LICENSE +21 -0
  9. data/README.md +36 -0
  10. data/Rakefile +7 -0
  11. data/bin/console +14 -0
  12. data/bin/rubyhome +16 -0
  13. data/bin/setup +8 -0
  14. data/lib/ruby_home.rb +6 -0
  15. data/lib/ruby_home/accessory_info.rb +99 -0
  16. data/lib/ruby_home/broadcast.rb +31 -0
  17. data/lib/ruby_home/config/characteristics.yml +1692 -0
  18. data/lib/ruby_home/config/services.yml +416 -0
  19. data/lib/ruby_home/device_id.rb +30 -0
  20. data/lib/ruby_home/dns/service.rb +44 -0
  21. data/lib/ruby_home/dns/text_record.rb +100 -0
  22. data/lib/ruby_home/factories/accessory_factory.rb +78 -0
  23. data/lib/ruby_home/factories/characteristic_factory.rb +57 -0
  24. data/lib/ruby_home/factories/templates/characteristic_template.rb +43 -0
  25. data/lib/ruby_home/factories/templates/service_template.rb +50 -0
  26. data/lib/ruby_home/hap/accessory.rb +26 -0
  27. data/lib/ruby_home/hap/characteristic.rb +60 -0
  28. data/lib/ruby_home/hap/hex_pad.rb +13 -0
  29. data/lib/ruby_home/hap/hkdf_encryption.rb +34 -0
  30. data/lib/ruby_home/hap/http_decryption.rb +58 -0
  31. data/lib/ruby_home/hap/http_encryption.rb +43 -0
  32. data/lib/ruby_home/hap/service.rb +38 -0
  33. data/lib/ruby_home/http/application.rb +28 -0
  34. data/lib/ruby_home/http/cache.rb +30 -0
  35. data/lib/ruby_home/http/controllers/accessories_controller.rb +19 -0
  36. data/lib/ruby_home/http/controllers/application_controller.rb +37 -0
  37. data/lib/ruby_home/http/controllers/characteristics_controller.rb +49 -0
  38. data/lib/ruby_home/http/controllers/pair_setups_controller.rb +146 -0
  39. data/lib/ruby_home/http/controllers/pair_verifies_controller.rb +81 -0
  40. data/lib/ruby_home/http/controllers/pairings_controller.rb +38 -0
  41. data/lib/ruby_home/http/hap_request.rb +56 -0
  42. data/lib/ruby_home/http/hap_response.rb +57 -0
  43. data/lib/ruby_home/http/hap_server.rb +65 -0
  44. data/lib/ruby_home/http/serializers/accessory_serializer.rb +21 -0
  45. data/lib/ruby_home/http/serializers/characteristic_serializer.rb +26 -0
  46. data/lib/ruby_home/http/serializers/characteristic_value_serializer.rb +21 -0
  47. data/lib/ruby_home/http/serializers/object_serializer.rb +39 -0
  48. data/lib/ruby_home/http/serializers/service_serializer.rb +20 -0
  49. data/lib/ruby_home/identifier_cache.rb +59 -0
  50. data/lib/ruby_home/rack/handler/hap_server.rb +26 -0
  51. data/lib/ruby_home/tlv.rb +83 -0
  52. data/lib/ruby_home/tlv/bytes.rb +19 -0
  53. data/lib/ruby_home/tlv/int.rb +15 -0
  54. data/lib/ruby_home/tlv/utf8.rb +18 -0
  55. data/lib/ruby_home/version.rb +3 -0
  56. data/rubyhome.gemspec +43 -0
  57. data/sbin/characteristic_generator.rb +83 -0
  58. data/sbin/service_generator.rb +69 -0
  59. metadata +352 -0
@@ -0,0 +1,416 @@
1
+ ---
2
+ - :name: :accessory_information
3
+ :description: Accessory Information
4
+ :uuid: 0000003E-0000-1000-8000-0026BB765291
5
+ :optional_characteristics_uuids:
6
+ - 00000053-0000-1000-8000-0026BB765291
7
+ - 000000A6-0000-1000-8000-0026BB765291
8
+ :required_characteristics_uuids:
9
+ - 00000014-0000-1000-8000-0026BB765291
10
+ - 00000020-0000-1000-8000-0026BB765291
11
+ - 00000021-0000-1000-8000-0026BB765291
12
+ - 00000023-0000-1000-8000-0026BB765291
13
+ - 00000030-0000-1000-8000-0026BB765291
14
+ - 00000052-0000-1000-8000-0026BB765291
15
+ - :name: :air_purifier
16
+ :description: Air Purifier
17
+ :uuid: 000000BB-0000-1000-8000-0026BB765291
18
+ :optional_characteristics_uuids:
19
+ - 000000A7-0000-1000-8000-0026BB765291
20
+ - 00000023-0000-1000-8000-0026BB765291
21
+ - 000000B6-0000-1000-8000-0026BB765291
22
+ - '00000029-0000-1000-8000-0026BB765291'
23
+ :required_characteristics_uuids:
24
+ - 000000B0-0000-1000-8000-0026BB765291
25
+ - 000000A9-0000-1000-8000-0026BB765291
26
+ - 000000A8-0000-1000-8000-0026BB765291
27
+ - :name: :air_quality_sensor
28
+ :description: Air Quality Sensor
29
+ :uuid: '0000008D-0000-1000-8000-0026BB765291'
30
+ :optional_characteristics_uuids:
31
+ - 00000075-0000-1000-8000-0026BB765291
32
+ - 00000077-0000-1000-8000-0026BB765291
33
+ - 0000007A-0000-1000-8000-0026BB765291
34
+ - '00000079-0000-1000-8000-0026BB765291'
35
+ - 00000023-0000-1000-8000-0026BB765291
36
+ - 000000C3-0000-1000-8000-0026BB765291
37
+ - 000000C4-0000-1000-8000-0026BB765291
38
+ - 000000C5-0000-1000-8000-0026BB765291
39
+ - 000000C6-0000-1000-8000-0026BB765291
40
+ - 000000C7-0000-1000-8000-0026BB765291
41
+ - 000000C8-0000-1000-8000-0026BB765291
42
+ - '00000090-0000-1000-8000-0026BB765291'
43
+ - '00000093-0000-1000-8000-0026BB765291'
44
+ :required_characteristics_uuids:
45
+ - '00000095-0000-1000-8000-0026BB765291'
46
+ - :name: :battery_service
47
+ :description: Battery Service
48
+ :uuid: '00000096-0000-1000-8000-0026BB765291'
49
+ :optional_characteristics_uuids:
50
+ - 00000023-0000-1000-8000-0026BB765291
51
+ :required_characteristics_uuids:
52
+ - '00000068-0000-1000-8000-0026BB765291'
53
+ - '0000008F-0000-1000-8000-0026BB765291'
54
+ - '00000079-0000-1000-8000-0026BB765291'
55
+ - :name: :camera_rtp_stream_management
56
+ :description: Camera RTP Stream Management
57
+ :uuid: 00000110-0000-1000-8000-0026BB765291
58
+ :optional_characteristics_uuids:
59
+ - 00000023-0000-1000-8000-0026BB765291
60
+ :required_characteristics_uuids:
61
+ - 00000114-0000-1000-8000-0026BB765291
62
+ - 00000115-0000-1000-8000-0026BB765291
63
+ - 00000116-0000-1000-8000-0026BB765291
64
+ - 00000117-0000-1000-8000-0026BB765291
65
+ - 00000120-0000-1000-8000-0026BB765291
66
+ - '00000118-0000-1000-8000-0026BB765291'
67
+ - :name: :carbon_dioxide_sensor
68
+ :description: Carbon Dioxide Sensor
69
+ :uuid: '00000097-0000-1000-8000-0026BB765291'
70
+ :optional_characteristics_uuids:
71
+ - 00000075-0000-1000-8000-0026BB765291
72
+ - 00000077-0000-1000-8000-0026BB765291
73
+ - '00000079-0000-1000-8000-0026BB765291'
74
+ - 0000007A-0000-1000-8000-0026BB765291
75
+ - '00000093-0000-1000-8000-0026BB765291'
76
+ - '00000094-0000-1000-8000-0026BB765291'
77
+ - 00000023-0000-1000-8000-0026BB765291
78
+ :required_characteristics_uuids:
79
+ - '00000092-0000-1000-8000-0026BB765291'
80
+ - :name: :carbon_monoxide_sensor
81
+ :description: Carbon Monoxide Sensor
82
+ :uuid: 0000007F-0000-1000-8000-0026BB765291
83
+ :optional_characteristics_uuids:
84
+ - 00000075-0000-1000-8000-0026BB765291
85
+ - 00000077-0000-1000-8000-0026BB765291
86
+ - '00000079-0000-1000-8000-0026BB765291'
87
+ - 0000007A-0000-1000-8000-0026BB765291
88
+ - '00000090-0000-1000-8000-0026BB765291'
89
+ - '00000091-0000-1000-8000-0026BB765291'
90
+ - 00000023-0000-1000-8000-0026BB765291
91
+ :required_characteristics_uuids:
92
+ - '00000069-0000-1000-8000-0026BB765291'
93
+ - :name: :contact_sensor
94
+ :description: Contact Sensor
95
+ :uuid: '00000080-0000-1000-8000-0026BB765291'
96
+ :optional_characteristics_uuids:
97
+ - 00000075-0000-1000-8000-0026BB765291
98
+ - 00000077-0000-1000-8000-0026BB765291
99
+ - 0000007A-0000-1000-8000-0026BB765291
100
+ - '00000079-0000-1000-8000-0026BB765291'
101
+ - 00000023-0000-1000-8000-0026BB765291
102
+ :required_characteristics_uuids:
103
+ - 0000006A-0000-1000-8000-0026BB765291
104
+ - :name: :door
105
+ :description: Door
106
+ :uuid: '00000081-0000-1000-8000-0026BB765291'
107
+ :optional_characteristics_uuids:
108
+ - 0000006F-0000-1000-8000-0026BB765291
109
+ - 00000024-0000-1000-8000-0026BB765291
110
+ - 00000023-0000-1000-8000-0026BB765291
111
+ :required_characteristics_uuids:
112
+ - 0000006D-0000-1000-8000-0026BB765291
113
+ - 00000072-0000-1000-8000-0026BB765291
114
+ - 0000007C-0000-1000-8000-0026BB765291
115
+ - :name: :doorbell
116
+ :description: Doorbell
117
+ :uuid: 00000121-0000-1000-8000-0026BB765291
118
+ :optional_characteristics_uuids:
119
+ - '00000008-0000-1000-8000-0026BB765291'
120
+ - '00000119-0000-1000-8000-0026BB765291'
121
+ - 00000023-0000-1000-8000-0026BB765291
122
+ :required_characteristics_uuids:
123
+ - 00000073-0000-1000-8000-0026BB765291
124
+ - :name: :fan
125
+ :description: Fan
126
+ :uuid: 00000040-0000-1000-8000-0026BB765291
127
+ :optional_characteristics_uuids:
128
+ - '00000028-0000-1000-8000-0026BB765291'
129
+ - '00000029-0000-1000-8000-0026BB765291'
130
+ - 00000023-0000-1000-8000-0026BB765291
131
+ :required_characteristics_uuids:
132
+ - 00000025-0000-1000-8000-0026BB765291
133
+ - :name: :fan_v2
134
+ :description: Fan v2
135
+ :uuid: 000000B7-0000-1000-8000-0026BB765291
136
+ :optional_characteristics_uuids:
137
+ - 000000AF-0000-1000-8000-0026BB765291
138
+ - 000000BF-0000-1000-8000-0026BB765291
139
+ - 000000A7-0000-1000-8000-0026BB765291
140
+ - 00000023-0000-1000-8000-0026BB765291
141
+ - '00000028-0000-1000-8000-0026BB765291'
142
+ - '00000029-0000-1000-8000-0026BB765291'
143
+ - 000000B6-0000-1000-8000-0026BB765291
144
+ :required_characteristics_uuids:
145
+ - 000000B0-0000-1000-8000-0026BB765291
146
+ - :name: :filter_maintenance
147
+ :description: Filter Maintenance
148
+ :uuid: 000000BA-0000-1000-8000-0026BB765291
149
+ :optional_characteristics_uuids:
150
+ - 000000AB-0000-1000-8000-0026BB765291
151
+ - 000000AD-0000-1000-8000-0026BB765291
152
+ - 00000023-0000-1000-8000-0026BB765291
153
+ :required_characteristics_uuids:
154
+ - 000000AC-0000-1000-8000-0026BB765291
155
+ - :name: :garage_door_opener
156
+ :description: Garage Door Opener
157
+ :uuid: 00000041-0000-1000-8000-0026BB765291
158
+ :optional_characteristics_uuids:
159
+ - 0000001D-0000-1000-8000-0026BB765291
160
+ - 0000001E-0000-1000-8000-0026BB765291
161
+ - 00000023-0000-1000-8000-0026BB765291
162
+ :required_characteristics_uuids:
163
+ - 0000000E-0000-1000-8000-0026BB765291
164
+ - 00000032-0000-1000-8000-0026BB765291
165
+ - 00000024-0000-1000-8000-0026BB765291
166
+ - :name: :heater_cooler
167
+ :description: Heater Cooler
168
+ :uuid: 000000BC-0000-1000-8000-0026BB765291
169
+ :optional_characteristics_uuids:
170
+ - 000000A7-0000-1000-8000-0026BB765291
171
+ - 00000023-0000-1000-8000-0026BB765291
172
+ - 000000B6-0000-1000-8000-0026BB765291
173
+ - 0000000D-0000-1000-8000-0026BB765291
174
+ - 00000012-0000-1000-8000-0026BB765291
175
+ - 00000036-0000-1000-8000-0026BB765291
176
+ - '00000029-0000-1000-8000-0026BB765291'
177
+ :required_characteristics_uuids:
178
+ - 000000B0-0000-1000-8000-0026BB765291
179
+ - 000000B1-0000-1000-8000-0026BB765291
180
+ - 000000B2-0000-1000-8000-0026BB765291
181
+ - 00000011-0000-1000-8000-0026BB765291
182
+ - :name: :humidifier_dehumidifier
183
+ :description: Humidifier Dehumidifier
184
+ :uuid: 000000BD-0000-1000-8000-0026BB765291
185
+ :optional_characteristics_uuids:
186
+ - 000000A7-0000-1000-8000-0026BB765291
187
+ - 00000023-0000-1000-8000-0026BB765291
188
+ - 000000B6-0000-1000-8000-0026BB765291
189
+ - 000000B5-0000-1000-8000-0026BB765291
190
+ - 000000C9-0000-1000-8000-0026BB765291
191
+ - 000000CA-0000-1000-8000-0026BB765291
192
+ - '00000029-0000-1000-8000-0026BB765291'
193
+ :required_characteristics_uuids:
194
+ - 00000010-0000-1000-8000-0026BB765291
195
+ - 000000B3-0000-1000-8000-0026BB765291
196
+ - 000000B4-0000-1000-8000-0026BB765291
197
+ - 000000B0-0000-1000-8000-0026BB765291
198
+ - :name: :humidity_sensor
199
+ :description: Humidity Sensor
200
+ :uuid: '00000082-0000-1000-8000-0026BB765291'
201
+ :optional_characteristics_uuids:
202
+ - 00000075-0000-1000-8000-0026BB765291
203
+ - 00000077-0000-1000-8000-0026BB765291
204
+ - 0000007A-0000-1000-8000-0026BB765291
205
+ - '00000079-0000-1000-8000-0026BB765291'
206
+ - 00000023-0000-1000-8000-0026BB765291
207
+ :required_characteristics_uuids:
208
+ - 00000010-0000-1000-8000-0026BB765291
209
+ - :name: :leak_sensor
210
+ :description: Leak Sensor
211
+ :uuid: '00000083-0000-1000-8000-0026BB765291'
212
+ :optional_characteristics_uuids:
213
+ - 00000075-0000-1000-8000-0026BB765291
214
+ - 00000077-0000-1000-8000-0026BB765291
215
+ - 0000007A-0000-1000-8000-0026BB765291
216
+ - '00000079-0000-1000-8000-0026BB765291'
217
+ - 00000023-0000-1000-8000-0026BB765291
218
+ :required_characteristics_uuids:
219
+ - 00000070-0000-1000-8000-0026BB765291
220
+ - :name: :light_sensor
221
+ :description: Light Sensor
222
+ :uuid: '00000084-0000-1000-8000-0026BB765291'
223
+ :optional_characteristics_uuids:
224
+ - 00000075-0000-1000-8000-0026BB765291
225
+ - 00000077-0000-1000-8000-0026BB765291
226
+ - 0000007A-0000-1000-8000-0026BB765291
227
+ - '00000079-0000-1000-8000-0026BB765291'
228
+ - 00000023-0000-1000-8000-0026BB765291
229
+ :required_characteristics_uuids:
230
+ - 0000006B-0000-1000-8000-0026BB765291
231
+ - :name: :lightbulb
232
+ :description: Lightbulb
233
+ :uuid: 00000043-0000-1000-8000-0026BB765291
234
+ :optional_characteristics_uuids:
235
+ - '00000008-0000-1000-8000-0026BB765291'
236
+ - 00000013-0000-1000-8000-0026BB765291
237
+ - 0000002F-0000-1000-8000-0026BB765291
238
+ - 00000023-0000-1000-8000-0026BB765291
239
+ :required_characteristics_uuids:
240
+ - 00000025-0000-1000-8000-0026BB765291
241
+ - :name: :lock_management
242
+ :description: Lock Management
243
+ :uuid: 00000044-0000-1000-8000-0026BB765291
244
+ :optional_characteristics_uuids:
245
+ - 0000001F-0000-1000-8000-0026BB765291
246
+ - 00000005-0000-1000-8000-0026BB765291
247
+ - 0000001A-0000-1000-8000-0026BB765291
248
+ - 00000001-0000-1000-8000-0026BB765291
249
+ - 0000001C-0000-1000-8000-0026BB765291
250
+ - 0000000E-0000-1000-8000-0026BB765291
251
+ - 00000022-0000-1000-8000-0026BB765291
252
+ - 00000023-0000-1000-8000-0026BB765291
253
+ :required_characteristics_uuids:
254
+ - '00000019-0000-1000-8000-0026BB765291'
255
+ - 00000037-0000-1000-8000-0026BB765291
256
+ - :name: :lock_mechanism
257
+ :description: Lock Mechanism
258
+ :uuid: 00000045-0000-1000-8000-0026BB765291
259
+ :optional_characteristics_uuids:
260
+ - 00000023-0000-1000-8000-0026BB765291
261
+ :required_characteristics_uuids:
262
+ - 0000001D-0000-1000-8000-0026BB765291
263
+ - 0000001E-0000-1000-8000-0026BB765291
264
+ - :name: :microphone
265
+ :description: Microphone
266
+ :uuid: 00000112-0000-1000-8000-0026BB765291
267
+ :optional_characteristics_uuids:
268
+ - '00000119-0000-1000-8000-0026BB765291'
269
+ - 00000023-0000-1000-8000-0026BB765291
270
+ :required_characteristics_uuids:
271
+ - 0000011A-0000-1000-8000-0026BB765291
272
+ - :name: :motion_sensor
273
+ :description: Motion Sensor
274
+ :uuid: '00000085-0000-1000-8000-0026BB765291'
275
+ :optional_characteristics_uuids:
276
+ - 00000075-0000-1000-8000-0026BB765291
277
+ - 00000077-0000-1000-8000-0026BB765291
278
+ - 0000007A-0000-1000-8000-0026BB765291
279
+ - '00000079-0000-1000-8000-0026BB765291'
280
+ - 00000023-0000-1000-8000-0026BB765291
281
+ :required_characteristics_uuids:
282
+ - 00000022-0000-1000-8000-0026BB765291
283
+ - :name: :occupancy_sensor
284
+ :description: Occupancy Sensor
285
+ :uuid: '00000086-0000-1000-8000-0026BB765291'
286
+ :optional_characteristics_uuids:
287
+ - 00000075-0000-1000-8000-0026BB765291
288
+ - 00000077-0000-1000-8000-0026BB765291
289
+ - 0000007A-0000-1000-8000-0026BB765291
290
+ - '00000079-0000-1000-8000-0026BB765291'
291
+ - 00000023-0000-1000-8000-0026BB765291
292
+ :required_characteristics_uuids:
293
+ - 00000071-0000-1000-8000-0026BB765291
294
+ - :name: :outlet
295
+ :description: Outlet
296
+ :uuid: 00000047-0000-1000-8000-0026BB765291
297
+ :optional_characteristics_uuids:
298
+ - 00000023-0000-1000-8000-0026BB765291
299
+ :required_characteristics_uuids:
300
+ - 00000025-0000-1000-8000-0026BB765291
301
+ - 00000026-0000-1000-8000-0026BB765291
302
+ - :name: :security_system
303
+ :description: Security System
304
+ :uuid: 0000007E-0000-1000-8000-0026BB765291
305
+ :optional_characteristics_uuids:
306
+ - 00000077-0000-1000-8000-0026BB765291
307
+ - 0000007A-0000-1000-8000-0026BB765291
308
+ - '0000008E-0000-1000-8000-0026BB765291'
309
+ - 00000023-0000-1000-8000-0026BB765291
310
+ :required_characteristics_uuids:
311
+ - 00000066-0000-1000-8000-0026BB765291
312
+ - 00000067-0000-1000-8000-0026BB765291
313
+ - :name: :service_label
314
+ :description: Service Label
315
+ :uuid: 000000CC-0000-1000-8000-0026BB765291
316
+ :optional_characteristics_uuids:
317
+ - 00000023-0000-1000-8000-0026BB765291
318
+ :required_characteristics_uuids:
319
+ - 000000CD-0000-1000-8000-0026BB765291
320
+ - :name: :slat
321
+ :description: Slat
322
+ :uuid: 000000B9-0000-1000-8000-0026BB765291
323
+ :optional_characteristics_uuids:
324
+ - 00000023-0000-1000-8000-0026BB765291
325
+ - 000000C1-0000-1000-8000-0026BB765291
326
+ - 000000C2-0000-1000-8000-0026BB765291
327
+ - 000000B6-0000-1000-8000-0026BB765291
328
+ :required_characteristics_uuids:
329
+ - 000000C0-0000-1000-8000-0026BB765291
330
+ - 000000AA-0000-1000-8000-0026BB765291
331
+ - :name: :smoke_sensor
332
+ :description: Smoke Sensor
333
+ :uuid: '00000087-0000-1000-8000-0026BB765291'
334
+ :optional_characteristics_uuids:
335
+ - 00000075-0000-1000-8000-0026BB765291
336
+ - 00000077-0000-1000-8000-0026BB765291
337
+ - 0000007A-0000-1000-8000-0026BB765291
338
+ - '00000079-0000-1000-8000-0026BB765291'
339
+ - 00000023-0000-1000-8000-0026BB765291
340
+ :required_characteristics_uuids:
341
+ - 00000076-0000-1000-8000-0026BB765291
342
+ - :name: :speaker
343
+ :description: Speaker
344
+ :uuid: 00000113-0000-1000-8000-0026BB765291
345
+ :optional_characteristics_uuids:
346
+ - '00000119-0000-1000-8000-0026BB765291'
347
+ - 00000023-0000-1000-8000-0026BB765291
348
+ :required_characteristics_uuids:
349
+ - 0000011A-0000-1000-8000-0026BB765291
350
+ - :name: :stateless_programmable_switch
351
+ :description: Stateless Programmable Switch
352
+ :uuid: '00000089-0000-1000-8000-0026BB765291'
353
+ :optional_characteristics_uuids:
354
+ - 00000023-0000-1000-8000-0026BB765291
355
+ - 000000CB-0000-1000-8000-0026BB765291
356
+ :required_characteristics_uuids:
357
+ - 00000073-0000-1000-8000-0026BB765291
358
+ - :name: :switch
359
+ :description: Switch
360
+ :uuid: '00000049-0000-1000-8000-0026BB765291'
361
+ :optional_characteristics_uuids:
362
+ - 00000023-0000-1000-8000-0026BB765291
363
+ :required_characteristics_uuids:
364
+ - 00000025-0000-1000-8000-0026BB765291
365
+ - :name: :temperature_sensor
366
+ :description: Temperature Sensor
367
+ :uuid: '0000008A-0000-1000-8000-0026BB765291'
368
+ :optional_characteristics_uuids:
369
+ - 00000075-0000-1000-8000-0026BB765291
370
+ - 00000077-0000-1000-8000-0026BB765291
371
+ - '00000079-0000-1000-8000-0026BB765291'
372
+ - 0000007A-0000-1000-8000-0026BB765291
373
+ - 00000023-0000-1000-8000-0026BB765291
374
+ :required_characteristics_uuids:
375
+ - 00000011-0000-1000-8000-0026BB765291
376
+ - :name: :thermostat
377
+ :description: Thermostat
378
+ :uuid: 0000004A-0000-1000-8000-0026BB765291
379
+ :optional_characteristics_uuids:
380
+ - 00000010-0000-1000-8000-0026BB765291
381
+ - 00000034-0000-1000-8000-0026BB765291
382
+ - 0000000D-0000-1000-8000-0026BB765291
383
+ - 00000012-0000-1000-8000-0026BB765291
384
+ - 00000023-0000-1000-8000-0026BB765291
385
+ :required_characteristics_uuids:
386
+ - 0000000F-0000-1000-8000-0026BB765291
387
+ - 00000033-0000-1000-8000-0026BB765291
388
+ - 00000011-0000-1000-8000-0026BB765291
389
+ - 00000035-0000-1000-8000-0026BB765291
390
+ - 00000036-0000-1000-8000-0026BB765291
391
+ - :name: :window
392
+ :description: Window
393
+ :uuid: '0000008B-0000-1000-8000-0026BB765291'
394
+ :optional_characteristics_uuids:
395
+ - 0000006F-0000-1000-8000-0026BB765291
396
+ - 00000024-0000-1000-8000-0026BB765291
397
+ - 00000023-0000-1000-8000-0026BB765291
398
+ :required_characteristics_uuids:
399
+ - 0000006D-0000-1000-8000-0026BB765291
400
+ - 0000007C-0000-1000-8000-0026BB765291
401
+ - 00000072-0000-1000-8000-0026BB765291
402
+ - :name: :window_covering
403
+ :description: Window Covering
404
+ :uuid: '0000008C-0000-1000-8000-0026BB765291'
405
+ :optional_characteristics_uuids:
406
+ - 0000006F-0000-1000-8000-0026BB765291
407
+ - 0000007B-0000-1000-8000-0026BB765291
408
+ - 0000007D-0000-1000-8000-0026BB765291
409
+ - 0000006C-0000-1000-8000-0026BB765291
410
+ - 0000006E-0000-1000-8000-0026BB765291
411
+ - 00000024-0000-1000-8000-0026BB765291
412
+ - 00000023-0000-1000-8000-0026BB765291
413
+ :required_characteristics_uuids:
414
+ - 0000006D-0000-1000-8000-0026BB765291
415
+ - 0000007C-0000-1000-8000-0026BB765291
416
+ - 00000072-0000-1000-8000-0026BB765291
@@ -0,0 +1,30 @@
1
+ module RubyHome
2
+ class DeviceID
3
+ class << self
4
+
5
+ DELIMITER = ':'
6
+
7
+ # Device ID of the accessory must be a unique random number generated at every
8
+ # factory reset and must persist across reboots
9
+
10
+ def generate(digits=12)
11
+ random_hexadecimals(digits)
12
+ .map(&:upcase)
13
+ .each_slice(2)
14
+ .map(&:join)
15
+ .join(DELIMITER)
16
+ end
17
+
18
+ def random_hexadecimal
19
+ rand(15).to_s(16)
20
+ end
21
+
22
+ def random_hexadecimals(digits=12)
23
+ digits
24
+ .times
25
+ .map { random_hexadecimal }
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,44 @@
1
+ require 'dnssd'
2
+ require_relative '../accessory_info'
3
+ require_relative 'text_record'
4
+
5
+ module RubyHome
6
+ module DNS
7
+ class Service
8
+ def initialize(port)
9
+ @port = port
10
+ end
11
+
12
+ def update
13
+ dnssd_service.add_record(DNSSD::Record::TXT, text_record.encode)
14
+ end
15
+
16
+ def register
17
+ dnssd_service
18
+ end
19
+
20
+ private
21
+
22
+ def dnssd_service
23
+ @_dnssd_service ||= begin
24
+ DNSSD::Service.register(name, type, nil, port, nil, text_record)
25
+ end
26
+ end
27
+
28
+ def name
29
+ 'RubyHome'
30
+ end
31
+
32
+ def type
33
+ '_hap._tcp'
34
+ end
35
+
36
+ attr_reader :port
37
+
38
+ def text_record
39
+ TextRecord.new(accessory_info: AccessoryInfo)
40
+ end
41
+ end
42
+ end
43
+ end
44
+