ruby_home 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yml +4 -4
  3. data/.gitignore +2 -2
  4. data/.rubocop.yml +2 -9
  5. data/.standard.yml +3 -0
  6. data/CHANGELOG.md +6 -1
  7. data/Gemfile +2 -2
  8. data/Rakefile +4 -4
  9. data/examples/air_purifier.rb +7 -8
  10. data/examples/air_quality_sensor.rb +8 -9
  11. data/examples/battery_service.rb +2 -3
  12. data/examples/carbon_dioxide_sensor.rb +2 -3
  13. data/examples/carbon_monoxide_sensor.rb +3 -4
  14. data/examples/contact_sensor.rb +2 -3
  15. data/examples/door.rb +5 -6
  16. data/examples/fan.rb +2 -3
  17. data/examples/fan_v2.rb +2 -3
  18. data/examples/garage_door_opener.rb +9 -10
  19. data/examples/heater_cooler.rb +9 -10
  20. data/examples/humidifier_dehumidifier.rb +9 -10
  21. data/examples/humidity_sensor.rb +2 -3
  22. data/examples/leak_sensor.rb +2 -3
  23. data/examples/light_sensor.rb +2 -3
  24. data/examples/lightbulb.rb +2 -3
  25. data/examples/lock_mechanism.rb +6 -7
  26. data/examples/motion_sensor.rb +2 -3
  27. data/examples/occupancy_sensor.rb +2 -3
  28. data/examples/outlet.rb +2 -3
  29. data/examples/security_system.rb +12 -13
  30. data/examples/smoke_sensor.rb +2 -3
  31. data/examples/switch.rb +2 -3
  32. data/examples/television.rb +8 -13
  33. data/examples/temperature_sensor.rb +2 -3
  34. data/examples/thermostat.rb +10 -11
  35. data/examples/window.rb +5 -6
  36. data/examples/window_covering.rb +5 -6
  37. data/lib/ruby_home.rb +21 -21
  38. data/lib/ruby_home/accessory.rb +1 -1
  39. data/lib/ruby_home/accessory_collection.rb +6 -6
  40. data/lib/ruby_home/accessory_info.rb +18 -18
  41. data/lib/ruby_home/characteristic.rb +8 -8
  42. data/lib/ruby_home/characteristic_collection.rb +13 -13
  43. data/lib/ruby_home/config/characteristics.yml +30 -635
  44. data/lib/ruby_home/config/manual_characteristics.yml +278 -0
  45. data/lib/ruby_home/config/manual_services.yml +45 -0
  46. data/lib/ruby_home/config/services.yml +329 -370
  47. data/lib/ruby_home/configuration.rb +4 -4
  48. data/lib/ruby_home/device_id.rb +3 -3
  49. data/lib/ruby_home/dns/service.rb +4 -6
  50. data/lib/ruby_home/dns/text_record.rb +9 -9
  51. data/lib/ruby_home/errors.rb +1 -0
  52. data/lib/ruby_home/factories/characteristic_factory.rb +37 -37
  53. data/lib/ruby_home/factories/service_factory.rb +72 -72
  54. data/lib/ruby_home/factories/templates/characteristic_template.rb +5 -5
  55. data/lib/ruby_home/factories/templates/service_template.rb +11 -10
  56. data/lib/ruby_home/hap/crypto/chacha20poly1305.rb +2 -2
  57. data/lib/ruby_home/hap/crypto/hkdf.rb +4 -4
  58. data/lib/ruby_home/hap/crypto/session_key.rb +7 -7
  59. data/lib/ruby_home/hap/decrypter.rb +8 -8
  60. data/lib/ruby_home/hap/encrypter.rb +5 -6
  61. data/lib/ruby_home/hap/ev_response.rb +17 -17
  62. data/lib/ruby_home/hap/hap_request.rb +1 -1
  63. data/lib/ruby_home/hap/server.rb +4 -4
  64. data/lib/ruby_home/hap/server_handler.rb +8 -10
  65. data/lib/ruby_home/hap/session.rb +22 -22
  66. data/lib/ruby_home/hap/values/base_value.rb +3 -3
  67. data/lib/ruby_home/hap/values/bool_value.rb +4 -4
  68. data/lib/ruby_home/hap/values/float_value.rb +4 -4
  69. data/lib/ruby_home/hap/values/identify_value.rb +1 -1
  70. data/lib/ruby_home/hap/values/int32_value.rb +4 -4
  71. data/lib/ruby_home/hap/values/null_value.rb +1 -1
  72. data/lib/ruby_home/hap/values/string_value.rb +11 -11
  73. data/lib/ruby_home/hap/values/uint32_value.rb +5 -5
  74. data/lib/ruby_home/hap/values/uint8_value.rb +14 -14
  75. data/lib/ruby_home/hex_helper.rb +3 -3
  76. data/lib/ruby_home/http/application.rb +7 -7
  77. data/lib/ruby_home/http/controllers/accessories_controller.rb +3 -3
  78. data/lib/ruby_home/http/controllers/application_controller.rb +6 -6
  79. data/lib/ruby_home/http/controllers/characteristics_controller.rb +29 -29
  80. data/lib/ruby_home/http/controllers/identify_controller.rb +10 -10
  81. data/lib/ruby_home/http/controllers/pair_setups_controller.rb +18 -18
  82. data/lib/ruby_home/http/controllers/pair_verifies_controller.rb +9 -9
  83. data/lib/ruby_home/http/controllers/pairings_controller.rb +5 -5
  84. data/lib/ruby_home/http/serializers/accessory_serializer.rb +5 -5
  85. data/lib/ruby_home/http/serializers/characteristic_serializer.rb +24 -24
  86. data/lib/ruby_home/http/serializers/characteristic_value_serializer.rb +5 -5
  87. data/lib/ruby_home/http/serializers/object_serializer.rb +1 -1
  88. data/lib/ruby_home/http/serializers/service_serializer.rb +9 -9
  89. data/lib/ruby_home/http/serializers/uuid_helper.rb +2 -2
  90. data/lib/ruby_home/http/services/session_notifier.rb +8 -8
  91. data/lib/ruby_home/http/services/start_srp_service.rb +3 -3
  92. data/lib/ruby_home/http/services/verify_finish_service.rb +22 -22
  93. data/lib/ruby_home/http/services/verify_srp_service.rb +22 -22
  94. data/lib/ruby_home/identifier_cache.rb +4 -5
  95. data/lib/ruby_home/password.rb +14 -14
  96. data/lib/ruby_home/persistable.rb +22 -7
  97. data/lib/ruby_home/service.rb +3 -3
  98. data/lib/ruby_home/service_collection.rb +1 -1
  99. data/lib/ruby_home/version.rb +1 -1
  100. data/rubyhome.gemspec +31 -31
  101. data/sbin/characteristic_generator.rb +22 -24
  102. data/sbin/service_generator.rb +36 -27
  103. metadata +25 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: faee051d71617c37bbbaf0274d1469db94770d0623bc415a7f8448ff7ce4408b
4
- data.tar.gz: c207e5bb1bec2c07d86183e912c21a3f8f4e8c3c4c27b639cd955a9a3d21b887
3
+ metadata.gz: 01126dd521e4351b6b7b801bfbb2e4bfd9ab6e19d47ce1715dc9c964ea5dfeca
4
+ data.tar.gz: be5d09f37ec55495c374778c4e2c0baea87edd16ea791ff2f9ca65a90a0666ad
5
5
  SHA512:
6
- metadata.gz: 601d7ef1d41989e34ae7ba3a336dcf3b36c93a693a0bfb8d998afc2aae7e9bcf243c65406eab992269f03e627ef71f0b01be904969b37e063c2472f4b438a022
7
- data.tar.gz: 7f5ee6ca44cabbdbf316e1a21c388ba09173e4a69853a8505d80249bd4602ee9f0cf609c8a6755fc6b6337c540d4a712573f1d4984b1435dd008ed04a77d8b49
6
+ metadata.gz: 96fb624e38e24b0b6fc709f6df2f7dd048b2514210f1cd4b43e91a36c2de1bc0f8de22848bb106b44ab7e17f3efbfcab7a3ad839275a819391c745e890e299ea
7
+ data.tar.gz: bbbc772b8da1669307f63753f23ad07f1ada6e9f675e0a02e174f9653a94f67245cd13564c9d7e57f163fa2ebc1cb4526071df2ef5dc7763466146f446bfb852
@@ -2,16 +2,16 @@ name: Tests
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ master ]
5
+ branches: [ main ]
6
6
  pull_request:
7
- branches: [ master ]
7
+ branches: [ main ]
8
8
 
9
9
  jobs:
10
10
  ubuntu:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: [3.0, 2.7, 2.6, 2.5]
14
+ ruby-version: [3.0, 2.7, 2.6]
15
15
  steps:
16
16
  - name: Install libdnssd
17
17
  run: sudo apt-get install libavahi-compat-libdnssd-dev
@@ -28,7 +28,7 @@ jobs:
28
28
  runs-on: macos-latest
29
29
  strategy:
30
30
  matrix:
31
- ruby-version: [3.0, 2.7, 2.6, 2.5]
31
+ ruby-version: [3.0, 2.7, 2.6]
32
32
  steps:
33
33
  - uses: actions/checkout@v2
34
34
  - name: Set up Ruby ${{ matrix.ruby-version }}
data/.gitignore CHANGED
@@ -1,14 +1,14 @@
1
1
  .byebug_history
2
2
  .rspec_status
3
+ .ruby-version
3
4
  /.bundle/
5
+ /.rubocop-*
4
6
  /.yardoc
5
7
  /_yardoc/
6
8
  /coverage/
7
9
  /doc/
8
10
  /pkg/
9
11
  /spec/reports/
10
- /tmp/
11
12
  Gemfile.lock
12
13
  accessory_info.yml
13
14
  identifier_cache.yml
14
- .ruby-version
data/.rubocop.yml CHANGED
@@ -1,9 +1,2 @@
1
- Style:
2
- TrailingCommaInLiteral:
3
- Enabled: false
4
- Documentation:
5
- Enabled: false
6
- FrozenStringLiteralComment:
7
- Enabled: false
8
- IndentationConsistency:
9
- AllowProtectedAndPrivateMethodsBeIndented: true
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/testdouble/standard/master/config/base.yml
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ ignore:
2
+ - 'examples/*':
3
+ - Lint/UselessAssignment
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # ruby_home Changelog
2
2
 
3
+ ## [v0.2.6](https://github.com/karlentwistle/ruby_home/releases/tag/v0.2.6) (2021-05-25)
4
+
5
+ ### Features
6
+
7
+ * Introduce in memory cache for identifier_cache and accessory_info to improve read performance
8
+
3
9
  ## [v0.2.5](https://github.com/karlentwistle/ruby_home/releases/tag/v0.2.5) (2021-01-22)
4
10
 
5
11
  ### Features
@@ -7,7 +13,6 @@
7
13
  * Added support for television service and characteristics (#100, @johndbritton, @getowic)
8
14
  * category_identifier can now be configured (#100, @getowic)
9
15
 
10
-
11
16
  ### Fixes
12
17
 
13
18
  * Fix Ruby 3.0 LoadError (#102, @karlentwistle)
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| 'https://github.com/#{repo_name}' }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in ruby_home.gemspec
6
6
  gemspec
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
- require_relative 'lib/ruby_home'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require_relative "lib/ruby_home"
4
4
 
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
 
7
- task :default => :spec
7
+ task default: :spec
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  air_purifier = RubyHome::ServiceFactory.create(:air_purifier,
@@ -8,12 +8,11 @@ air_purifier = RubyHome::ServiceFactory.create(:air_purifier,
8
8
  name: "air purifier", # optional
9
9
  rotation_speed: 0, # optional
10
10
  swing_mode: 1, # optional
11
- lock_physical_controls: 0, # optional
12
- )
11
+ lock_physical_controls: 0) # optional
13
12
 
14
13
  target_air_purifier_state_values = {
15
- 0 => 'Manual',
16
- 1 => 'Auto',
14
+ 0 => "Manual",
15
+ 1 => "Auto"
17
16
  }
18
17
  air_purifier.target_air_purifier_state.after_update do |target_air_purifier_state|
19
18
  state = target_air_purifier_state_values[target_air_purifier_state]
@@ -21,9 +20,9 @@ air_purifier.target_air_purifier_state.after_update do |target_air_purifier_stat
21
20
  end
22
21
 
23
22
  current_air_purifier_state_values = {
24
- 0 => 'Inactive',
25
- 1 => 'Idle',
26
- 2 => 'Purifying Air',
23
+ 0 => "Inactive",
24
+ 1 => "Idle",
25
+ 2 => "Purifying Air"
27
26
  }
28
27
  air_purifier.current_air_purifier_state.after_update do |current_air_purifier_state|
29
28
  state = current_air_purifier_state_values[current_air_purifier_state]
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  air_quality_sensor = RubyHome::ServiceFactory.create(:air_quality_sensor,
@@ -15,16 +15,15 @@ air_quality_sensor = RubyHome::ServiceFactory.create(:air_quality_sensor,
15
15
  status_low_battery: 0, # optional
16
16
  status_tampered: 0, # optional
17
17
  status_fault: 0, # optional
18
- status_active: true # optional
19
- )
18
+ status_active: true) # optional
20
19
 
21
20
  air_quality_values = {
22
- 0 => 'Unknown',
23
- 1 => 'Excellent',
24
- 2 => 'Good',
25
- 3 => 'Fair',
26
- 4 => 'Inferior',
27
- 5 => 'Poor'
21
+ 0 => "Unknown",
22
+ 1 => "Excellent",
23
+ 2 => "Good",
24
+ 3 => "Fair",
25
+ 4 => "Inferior",
26
+ 5 => "Poor"
28
27
  }
29
28
  air_quality_sensor.air_quality.after_update do |air_quality|
30
29
  state = air_quality_values[air_quality]
@@ -1,12 +1,11 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  battery_service = RubyHome::ServiceFactory.create(:battery_service,
5
5
  status_low_battery: 0, # required
6
6
  charging_state: 0, # required
7
7
  battery_level: 20, # required
8
- name: "battery service", # optional
9
- )
8
+ name: "battery service") # optional
10
9
 
11
10
  battery_service.status_low_battery.after_update do |status_low_battery|
12
11
  if status_low_battery == 0
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  carbon_dioxide_sensor = RubyHome::ServiceFactory.create(:carbon_dioxide_sensor,
@@ -9,8 +9,7 @@ carbon_dioxide_sensor = RubyHome::ServiceFactory.create(:carbon_dioxide_sensor,
9
9
  status_tampered: 0, # optional
10
10
  status_low_battery: 0, # optional
11
11
  status_fault: 0, # optional
12
- status_active: true # optional
13
- )
12
+ status_active: true) # optional
14
13
 
15
14
  carbon_dioxide_sensor.carbon_dioxide_detected.after_update do |carbon_dioxide_detected|
16
15
  if carbon_dioxide_detected == 0
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  carbon_monoxide_sensor = RubyHome::ServiceFactory.create(:carbon_monoxide_sensor,
@@ -9,8 +9,7 @@ carbon_monoxide_sensor = RubyHome::ServiceFactory.create(:carbon_monoxide_sensor
9
9
  status_tampered: 0, # optional
10
10
  status_low_battery: 0, # optional
11
11
  status_fault: 0, # optional
12
- status_active: true # optional
13
- )
12
+ status_active: true) # optional
14
13
 
15
14
  carbon_monoxide_sensor.carbon_monoxide_detected.after_update do |carbon_monoxide_detected|
16
15
  if carbon_monoxide_detected == 0
@@ -62,7 +61,7 @@ end
62
61
 
63
62
  Thread.new do
64
63
  sleep 30
65
-
64
+
66
65
  loop do
67
66
  carbon_monoxide_sensor.carbon_monoxide_detected = (0..1).to_a.sample
68
67
  carbon_monoxide_sensor.carbon_monoxide_peak_level = (0..100).to_a.sample
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  contact_sensor = RubyHome::ServiceFactory.create(:contact_sensor,
@@ -7,8 +7,7 @@ contact_sensor = RubyHome::ServiceFactory.create(:contact_sensor,
7
7
  status_low_battery: 0, # optional
8
8
  status_tampered: 0, # optional
9
9
  status_fault: 0, # optional
10
- status_active: true # optional
11
- )
10
+ status_active: true) # optional
12
11
 
13
12
  contact_sensor.contact_sensor_state.after_update do |contact_sensor_state|
14
13
  if contact_sensor_state == 0
data/examples/door.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  door = RubyHome::ServiceFactory.create(:door,
@@ -6,8 +6,7 @@ door = RubyHome::ServiceFactory.create(:door,
6
6
  position_state: 1, # required
7
7
  current_position: 0, # required
8
8
  name: "door", # optional
9
- obstruction_detected: false, # optional
10
- )
9
+ obstruction_detected: false) # optional
11
10
 
12
11
  door.target_position.after_update do |target_position|
13
12
  puts "door target position #{target_position}"
@@ -25,9 +24,9 @@ door.target_position.after_update do |target_position|
25
24
  end
26
25
 
27
26
  position_state_values = {
28
- 0 => 'Decreasing',
29
- 1 => 'Increasing',
30
- 2 => 'Stopped'
27
+ 0 => "Decreasing",
28
+ 1 => "Increasing",
29
+ 2 => "Stopped"
31
30
  }
32
31
  door.position_state.after_update do |position_state|
33
32
  state = position_state_values[position_state]
data/examples/fan.rb CHANGED
@@ -1,12 +1,11 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  fan = RubyHome::ServiceFactory.create(:fan,
5
5
  on: false, # required
6
6
  name: "fan", # optional
7
7
  rotation_speed: 50, # optional
8
- rotation_direction: 0 # optional
9
- )
8
+ rotation_direction: 0) # optional
10
9
 
11
10
  fan.on.after_update do |on|
12
11
  if on
data/examples/fan_v2.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  fan = RubyHome::ServiceFactory.create(:fan_v2,
@@ -9,8 +9,7 @@ fan = RubyHome::ServiceFactory.create(:fan_v2,
9
9
  rotation_direction: 0, # optional
10
10
  lock_physical_controls: 0, # optional
11
11
  target_fan_state: 0, # optional
12
- current_fan_state: 0 # optional
13
- )
12
+ current_fan_state: 0) # optional
14
13
 
15
14
  fan.active.after_update do |active|
16
15
  if active == 0
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  garage_door_opener = RubyHome::ServiceFactory.create(:garage_door_opener,
@@ -7,8 +7,7 @@ garage_door_opener = RubyHome::ServiceFactory.create(:garage_door_opener,
7
7
  current_door_state: 1, # required
8
8
  name: "garage door opener", # optional
9
9
  lock_target_state: 1, # optional
10
- lock_current_state: 1, # optional
11
- )
10
+ lock_current_state: 1) # optional
12
11
 
13
12
  garage_door_opener.obstruction_detected.after_update do |obstruction_detected|
14
13
  if obstruction_detected
@@ -19,8 +18,8 @@ garage_door_opener.obstruction_detected.after_update do |obstruction_detected|
19
18
  end
20
19
 
21
20
  target_door_state_values = {
22
- 0 => 'Open',
23
- 1 => 'Closed',
21
+ 0 => "Open",
22
+ 1 => "Closed"
24
23
  }
25
24
  garage_door_opener.target_door_state.after_update do |target_door_state|
26
25
  state = target_door_state_values[target_door_state]
@@ -38,11 +37,11 @@ garage_door_opener.target_door_state.after_update do |target_door_state|
38
37
  end
39
38
 
40
39
  current_door_state_values = {
41
- 0 => 'Open',
42
- 1 => 'Closed',
43
- 2 => 'Opening',
44
- 3 => 'Closing',
45
- 4 => 'Stopped'
40
+ 0 => "Open",
41
+ 1 => "Closed",
42
+ 2 => "Opening",
43
+ 3 => "Closing",
44
+ 4 => "Stopped"
46
45
  }
47
46
  garage_door_opener.current_door_state.after_update do |current_door_state|
48
47
  state = current_door_state_values[current_door_state]
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  heater_cooler = RubyHome::ServiceFactory.create(:heater_cooler,
@@ -12,17 +12,16 @@ heater_cooler = RubyHome::ServiceFactory.create(:heater_cooler,
12
12
  heating_threshold_temperature: 20, # optional
13
13
  cooling_threshold_temperature: 10, # optional
14
14
  swing_mode: 1, # optional
15
- lock_physical_controls: 0, # optional
16
- )
15
+ lock_physical_controls: 0) # optional
17
16
 
18
17
  heater_cooler.current_temperature.after_update do |current_temperature|
19
18
  puts "heater cooler current temperature in celsius #{current_temperature}"
20
19
  end
21
20
 
22
21
  target_heater_cooler_state_values = {
23
- 0 => 'Auto',
24
- 1 => 'Heat',
25
- 2 => 'Cool'
22
+ 0 => "Auto",
23
+ 1 => "Heat",
24
+ 2 => "Cool"
26
25
  }
27
26
  heater_cooler.target_heater_cooler_state.after_update do |target_heater_cooler_state|
28
27
  state = target_heater_cooler_state_values[target_heater_cooler_state]
@@ -30,10 +29,10 @@ heater_cooler.target_heater_cooler_state.after_update do |target_heater_cooler_s
30
29
  end
31
30
 
32
31
  current_heater_cooler_state_values = {
33
- 0 => 'Inactive',
34
- 1 => 'Idle',
35
- 2 => 'Heating',
36
- 3 => 'Cooling'
32
+ 0 => "Inactive",
33
+ 1 => "Idle",
34
+ 2 => "Heating",
35
+ 3 => "Cooling"
37
36
  }
38
37
  heater_cooler.current_heater_cooler_state.after_update do |current_heater_cooler_state|
39
38
  state = current_heater_cooler_state_values[current_heater_cooler_state]
@@ -1,4 +1,4 @@
1
- require 'ruby_home'
1
+ require "ruby_home"
2
2
 
3
3
  accessory_information = RubyHome::ServiceFactory.create(:accessory_information)
4
4
  humidifier_dehumidifier = RubyHome::ServiceFactory.create(:humidifier_dehumidifier,
@@ -12,8 +12,7 @@ humidifier_dehumidifier = RubyHome::ServiceFactory.create(:humidifier_dehumidifi
12
12
  relative_humidity_dehumidifier_threshold: 0, # optional
13
13
  water_level: 50, # optional
14
14
  swing_mode: 1, # optional
15
- lock_physical_controls: 0, # optional
16
- )
15
+ lock_physical_controls: 0) # optional
17
16
 
18
17
  humidifier_dehumidifier.active.after_update do |active|
19
18
  if active == 0
@@ -24,9 +23,9 @@ humidifier_dehumidifier.active.after_update do |active|
24
23
  end
25
24
 
26
25
  target_humidifier_dehumidifier_state_values = {
27
- 0 => 'Humidifier or Dehumidifier',
28
- 1 => 'Humidifier',
29
- 2 => 'Dehumidifier'
26
+ 0 => "Humidifier or Dehumidifier",
27
+ 1 => "Humidifier",
28
+ 2 => "Dehumidifier"
30
29
  }
31
30
  humidifier_dehumidifier.target_humidifier_dehumidifier_state.after_update do |target_humidifier_dehumidifier_state|
32
31
  state = target_humidifier_dehumidifier_state_values[target_humidifier_dehumidifier_state]
@@ -34,10 +33,10 @@ humidifier_dehumidifier.target_humidifier_dehumidifier_state.after_update do |ta
34
33
  end
35
34
 
36
35
  current_humidifier_dehumidifier_state_values = {
37
- 0 => 'Inactive',
38
- 1 => 'Idle',
39
- 2 => 'Humidifying',
40
- 3 => 'Dehumidifying'
36
+ 0 => "Inactive",
37
+ 1 => "Idle",
38
+ 2 => "Humidifying",
39
+ 3 => "Dehumidifying"
41
40
  }
42
41
  humidifier_dehumidifier.current_humidifier_dehumidifier_state.after_update do |current_humidifier_dehumidifier_state|
43
42
  state = current_humidifier_dehumidifier_state_values[current_humidifier_dehumidifier_state]