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.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +4 -4
- data/.gitignore +2 -2
- data/.rubocop.yml +2 -9
- data/.standard.yml +3 -0
- data/CHANGELOG.md +6 -1
- data/Gemfile +2 -2
- data/Rakefile +4 -4
- data/examples/air_purifier.rb +7 -8
- data/examples/air_quality_sensor.rb +8 -9
- data/examples/battery_service.rb +2 -3
- data/examples/carbon_dioxide_sensor.rb +2 -3
- data/examples/carbon_monoxide_sensor.rb +3 -4
- data/examples/contact_sensor.rb +2 -3
- data/examples/door.rb +5 -6
- data/examples/fan.rb +2 -3
- data/examples/fan_v2.rb +2 -3
- data/examples/garage_door_opener.rb +9 -10
- data/examples/heater_cooler.rb +9 -10
- data/examples/humidifier_dehumidifier.rb +9 -10
- data/examples/humidity_sensor.rb +2 -3
- data/examples/leak_sensor.rb +2 -3
- data/examples/light_sensor.rb +2 -3
- data/examples/lightbulb.rb +2 -3
- data/examples/lock_mechanism.rb +6 -7
- data/examples/motion_sensor.rb +2 -3
- data/examples/occupancy_sensor.rb +2 -3
- data/examples/outlet.rb +2 -3
- data/examples/security_system.rb +12 -13
- data/examples/smoke_sensor.rb +2 -3
- data/examples/switch.rb +2 -3
- data/examples/television.rb +8 -13
- data/examples/temperature_sensor.rb +2 -3
- data/examples/thermostat.rb +10 -11
- data/examples/window.rb +5 -6
- data/examples/window_covering.rb +5 -6
- data/lib/ruby_home.rb +21 -21
- data/lib/ruby_home/accessory.rb +1 -1
- data/lib/ruby_home/accessory_collection.rb +6 -6
- data/lib/ruby_home/accessory_info.rb +18 -18
- data/lib/ruby_home/characteristic.rb +8 -8
- data/lib/ruby_home/characteristic_collection.rb +13 -13
- data/lib/ruby_home/config/characteristics.yml +30 -635
- data/lib/ruby_home/config/manual_characteristics.yml +278 -0
- data/lib/ruby_home/config/manual_services.yml +45 -0
- data/lib/ruby_home/config/services.yml +329 -370
- data/lib/ruby_home/configuration.rb +4 -4
- data/lib/ruby_home/device_id.rb +3 -3
- data/lib/ruby_home/dns/service.rb +4 -6
- data/lib/ruby_home/dns/text_record.rb +9 -9
- data/lib/ruby_home/errors.rb +1 -0
- data/lib/ruby_home/factories/characteristic_factory.rb +37 -37
- data/lib/ruby_home/factories/service_factory.rb +72 -72
- data/lib/ruby_home/factories/templates/characteristic_template.rb +5 -5
- data/lib/ruby_home/factories/templates/service_template.rb +11 -10
- data/lib/ruby_home/hap/crypto/chacha20poly1305.rb +2 -2
- data/lib/ruby_home/hap/crypto/hkdf.rb +4 -4
- data/lib/ruby_home/hap/crypto/session_key.rb +7 -7
- data/lib/ruby_home/hap/decrypter.rb +8 -8
- data/lib/ruby_home/hap/encrypter.rb +5 -6
- data/lib/ruby_home/hap/ev_response.rb +17 -17
- data/lib/ruby_home/hap/hap_request.rb +1 -1
- data/lib/ruby_home/hap/server.rb +4 -4
- data/lib/ruby_home/hap/server_handler.rb +8 -10
- data/lib/ruby_home/hap/session.rb +22 -22
- data/lib/ruby_home/hap/values/base_value.rb +3 -3
- data/lib/ruby_home/hap/values/bool_value.rb +4 -4
- data/lib/ruby_home/hap/values/float_value.rb +4 -4
- data/lib/ruby_home/hap/values/identify_value.rb +1 -1
- data/lib/ruby_home/hap/values/int32_value.rb +4 -4
- data/lib/ruby_home/hap/values/null_value.rb +1 -1
- data/lib/ruby_home/hap/values/string_value.rb +11 -11
- data/lib/ruby_home/hap/values/uint32_value.rb +5 -5
- data/lib/ruby_home/hap/values/uint8_value.rb +14 -14
- data/lib/ruby_home/hex_helper.rb +3 -3
- data/lib/ruby_home/http/application.rb +7 -7
- data/lib/ruby_home/http/controllers/accessories_controller.rb +3 -3
- data/lib/ruby_home/http/controllers/application_controller.rb +6 -6
- data/lib/ruby_home/http/controllers/characteristics_controller.rb +29 -29
- data/lib/ruby_home/http/controllers/identify_controller.rb +10 -10
- data/lib/ruby_home/http/controllers/pair_setups_controller.rb +18 -18
- data/lib/ruby_home/http/controllers/pair_verifies_controller.rb +9 -9
- data/lib/ruby_home/http/controllers/pairings_controller.rb +5 -5
- data/lib/ruby_home/http/serializers/accessory_serializer.rb +5 -5
- data/lib/ruby_home/http/serializers/characteristic_serializer.rb +24 -24
- data/lib/ruby_home/http/serializers/characteristic_value_serializer.rb +5 -5
- data/lib/ruby_home/http/serializers/object_serializer.rb +1 -1
- data/lib/ruby_home/http/serializers/service_serializer.rb +9 -9
- data/lib/ruby_home/http/serializers/uuid_helper.rb +2 -2
- data/lib/ruby_home/http/services/session_notifier.rb +8 -8
- data/lib/ruby_home/http/services/start_srp_service.rb +3 -3
- data/lib/ruby_home/http/services/verify_finish_service.rb +22 -22
- data/lib/ruby_home/http/services/verify_srp_service.rb +22 -22
- data/lib/ruby_home/identifier_cache.rb +4 -5
- data/lib/ruby_home/password.rb +14 -14
- data/lib/ruby_home/persistable.rb +22 -7
- data/lib/ruby_home/service.rb +3 -3
- data/lib/ruby_home/service_collection.rb +1 -1
- data/lib/ruby_home/version.rb +1 -1
- data/rubyhome.gemspec +31 -31
- data/sbin/characteristic_generator.rb +22 -24
- data/sbin/service_generator.rb +36 -27
- metadata +25 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01126dd521e4351b6b7b801bfbb2e4bfd9ab6e19d47ce1715dc9c964ea5dfeca
|
4
|
+
data.tar.gz: be5d09f37ec55495c374778c4e2c0baea87edd16ea791ff2f9ca65a90a0666ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96fb624e38e24b0b6fc709f6df2f7dd048b2514210f1cd4b43e91a36c2de1bc0f8de22848bb106b44ab7e17f3efbfcab7a3ad839275a819391c745e890e299ea
|
7
|
+
data.tar.gz: bbbc772b8da1669307f63753f23ad07f1ada6e9f675e0a02e174f9653a94f67245cd13564c9d7e57f163fa2ebc1cb4526071df2ef5dc7763466146f446bfb852
|
data/.github/workflows/tests.yml
CHANGED
@@ -2,16 +2,16 @@ name: Tests
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches: [
|
5
|
+
branches: [ main ]
|
6
6
|
pull_request:
|
7
|
-
branches: [
|
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
|
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
|
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
data/.rubocop.yml
CHANGED
@@ -1,9 +1,2 @@
|
|
1
|
-
|
2
|
-
|
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
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
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
git_source(:github) {|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
|
2
|
-
require
|
3
|
-
require_relative
|
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 :
|
7
|
+
task default: :spec
|
data/examples/air_purifier.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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
|
12
|
-
)
|
11
|
+
lock_physical_controls: 0) # optional
|
13
12
|
|
14
13
|
target_air_purifier_state_values = {
|
15
|
-
0 =>
|
16
|
-
1 =>
|
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 =>
|
25
|
-
1 =>
|
26
|
-
2 =>
|
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
|
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 =>
|
23
|
-
1 =>
|
24
|
-
2 =>
|
25
|
-
3 =>
|
26
|
-
4 =>
|
27
|
-
5 =>
|
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]
|
data/examples/battery_service.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
require
|
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"
|
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
|
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
|
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
|
data/examples/contact_sensor.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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
|
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
|
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 =>
|
29
|
-
1 =>
|
30
|
-
2 =>
|
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
|
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
|
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
|
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
|
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 =>
|
23
|
-
1 =>
|
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 =>
|
42
|
-
1 =>
|
43
|
-
2 =>
|
44
|
-
3 =>
|
45
|
-
4 =>
|
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]
|
data/examples/heater_cooler.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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
|
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 =>
|
24
|
-
1 =>
|
25
|
-
2 =>
|
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 =>
|
34
|
-
1 =>
|
35
|
-
2 =>
|
36
|
-
3 =>
|
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
|
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
|
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 =>
|
28
|
-
1 =>
|
29
|
-
2 =>
|
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 =>
|
38
|
-
1 =>
|
39
|
-
2 =>
|
40
|
-
3 =>
|
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]
|