ruby_home 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1690,3 +1690,19 @@
1690
1690
  :constraints:
1691
1691
  MaximumValue: 100
1692
1692
  MinimumValue: 0
1693
+ - :name: :color_temperature
1694
+ :description: Color Temperature
1695
+ :uuid: 000000CE-0000-1000-8000-0026BB765291
1696
+ :format: uint32
1697
+ :unit: nil
1698
+ :permissions:
1699
+ - securedRead
1700
+ - securedWrite
1701
+ :properties:
1702
+ - read
1703
+ - write
1704
+ - cnotify
1705
+ :constraints:
1706
+ :MaximumValue: 400
1707
+ :MinimumValue: 50
1708
+ :StepValue: 1
@@ -236,6 +236,7 @@
236
236
  - 00000013-0000-1000-8000-0026BB765291
237
237
  - 0000002F-0000-1000-8000-0026BB765291
238
238
  - 00000023-0000-1000-8000-0026BB765291
239
+ - 000000CE-0000-1000-8000-0026BB765291
239
240
  :required_characteristics_uuids:
240
241
  - 00000025-0000-1000-8000-0026BB765291
241
242
  - :name: :lock_management
@@ -1,3 +1,3 @@
1
1
  module RubyHome
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -30,11 +30,11 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency 'dnssd', '~> 3.0'
31
31
  spec.add_dependency 'facets', '~> 3.1'
32
32
  spec.add_dependency 'hkdf', '~> 0.3.0'
33
- spec.add_dependency 'oj', '3.7.12'
34
- spec.add_dependency 'rbnacl', '~> 6.0'
33
+ spec.add_dependency 'oj', '3.9.1'
34
+ spec.add_dependency 'rbnacl', '~> 7.0'
35
35
  spec.add_dependency 'ruby_home-srp', '~> 1.3'
36
36
  spec.add_dependency 'ruby_home-tlv', '~> 0.1.0'
37
- spec.add_dependency 'sinatra', '2.0.5'
37
+ spec.add_dependency 'sinatra', '2.0.7'
38
38
  spec.add_dependency 'wisper', '~> 2.0'
39
39
 
40
40
  spec.add_development_dependency 'byebug', '~> 11.0'
@@ -10,16 +10,38 @@ module RubyHome
10
10
  def run
11
11
  convert_binary_plist
12
12
  File.open(file_path, 'w') do |file|
13
- file.write generate_characteristics.to_yaml
13
+ file.write characteristics.to_yaml
14
14
  end
15
15
  end
16
16
 
17
+ def characteristics
18
+ generate_characteristics + hardcoded_characteristics
19
+ end
20
+
17
21
  def generate_characteristics
18
22
  parsed_xml['Characteristics'].map do |characteristics_xml|
19
23
  new(characteristics_xml).generate_characteristic_hash
20
24
  end
21
25
  end
22
26
 
27
+ def hardcoded_characteristics
28
+ [
29
+ # HomeKit Accessory Simulator doesnt include color temperature as a characteristic
30
+ # HAP-Specification-Non-Commercial-Version lists it as a valid optional characteristic
31
+ {
32
+ name: :color_temperature,
33
+ description: 'Color Temperature',
34
+ uuid: '000000CE-0000-1000-8000-0026BB765291',
35
+ format: 'uint32',
36
+ unit: "nil",
37
+ permissions: %w(securedRead securedWrite),
38
+ properties: %w(read write cnotify),
39
+ constraints: { 'MaximumValue': 400, 'MinimumValue': 50, 'StepValue': 1 }
40
+ }
41
+ ]
42
+ end
43
+
44
+
23
45
  def convert_binary_plist
24
46
  system([
25
47
  'plutil -convert xml1 -o',
@@ -60,9 +60,19 @@ module RubyHome
60
60
  name.downcase.gsub(' ', '_')
61
61
  end
62
62
 
63
- private
63
+ COLOR_TEMPERATURE_UUID = -'000000CE-0000-1000-8000-0026BB765291'
64
64
 
65
- attr_reader :name, :optional_characteristics, :required_characteristics, :uuid
65
+ def optional_characteristics
66
+ if sanitized_name == 'lightbulb'
67
+ # HomeKit Accessory Simulator doesnt include color temperature as a characteristic
68
+ # HAP-Specification-Non-Commercial-Version lists it as a valid optional characteristic
69
+ @optional_characteristics + [COLOR_TEMPERATURE_UUID]
70
+ else
71
+ @optional_characteristics
72
+ end
73
+ end
74
+
75
+ attr_reader :name, :required_characteristics, :uuid
66
76
  end
67
77
  end
68
78
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_home
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Entwistle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-07 00:00:00.000000000 Z
11
+ date: 2019-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -78,28 +78,28 @@ dependencies:
78
78
  requirements:
79
79
  - - '='
80
80
  - !ruby/object:Gem::Version
81
- version: 3.7.12
81
+ version: 3.9.1
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 3.7.12
88
+ version: 3.9.1
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rbnacl
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '6.0'
95
+ version: '7.0'
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '6.0'
102
+ version: '7.0'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: ruby_home-srp
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - '='
136
136
  - !ruby/object:Gem::Version
137
- version: 2.0.5
137
+ version: 2.0.7
138
138
  type: :runtime
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - '='
143
143
  - !ruby/object:Gem::Version
144
- version: 2.0.5
144
+ version: 2.0.7
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: wisper
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -250,6 +250,33 @@ files:
250
250
  - bin/console
251
251
  - bin/ruby_home
252
252
  - bin/setup
253
+ - examples/air_purifier.rb
254
+ - examples/air_quality_sensor.rb
255
+ - examples/battery_service.rb
256
+ - examples/carbon_dioxide_sensor.rb
257
+ - examples/carbon_monoxide_sensor.rb
258
+ - examples/contact_sensor.rb
259
+ - examples/door.rb
260
+ - examples/fan.rb
261
+ - examples/fan_v2.rb
262
+ - examples/garage_door_opener.rb
263
+ - examples/heater_cooler.rb
264
+ - examples/humidifier_dehumidifier.rb
265
+ - examples/humidity_sensor.rb
266
+ - examples/leak_sensor.rb
267
+ - examples/light_sensor.rb
268
+ - examples/lightbulb.rb
269
+ - examples/lock_mechanism.rb
270
+ - examples/motion_sensor.rb
271
+ - examples/occupancy_sensor.rb
272
+ - examples/outlet.rb
273
+ - examples/security_system.rb
274
+ - examples/smoke_sensor.rb
275
+ - examples/switch.rb
276
+ - examples/temperature_sensor.rb
277
+ - examples/thermostat.rb
278
+ - examples/window.rb
279
+ - examples/window_covering.rb
253
280
  - lib/ruby_home.rb
254
281
  - lib/ruby_home/accessory.rb
255
282
  - lib/ruby_home/accessory_collection.rb
@@ -335,7 +362,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
335
362
  - !ruby/object:Gem::Version
336
363
  version: '0'
337
364
  requirements: []
338
- rubygems_version: 3.0.1
365
+ rubyforge_project:
366
+ rubygems_version: 2.7.6.2
339
367
  signing_key:
340
368
  specification_version: 4
341
369
  summary: Ruby HomeKit support