atrea_control 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +26 -26
- data/lib/atrea_control/duplex/unit.rb +15 -2
- data/lib/atrea_control/duplex/user_ctrl.rb +6 -0
- data/lib/atrea_control/sensor_parser.rb +13 -5
- data/lib/atrea_control/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47dfda0eb6906708f68c4d43dae4a9ed7249492e32150fb40e244302158a2f10
|
4
|
+
data.tar.gz: dd16ffa80d5b61380a14814690058165d3fc8b2e8ab79f3ca17d4ccf8f218e7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 109c78b115fc8652a5f2b113c5ac14972ae8e7a469ca4453365edf01a3c8898f3e25c78bf39a7da02947440868ddcdcfa8f9a2b5a3f0be997ece7f6bc3598319
|
7
|
+
data.tar.gz: 696a0c42c1fe2b4881247753f318290e52450299cebeab73c2faffee8e7b151f5f4000e8896fe42ef227184ae881a0a324306f02d49d1aba416061a3620f8e0b
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
atrea_control (2.0
|
4
|
+
atrea_control (2.1.0)
|
5
5
|
i18n (~> 1.8)
|
6
6
|
nokogiri (~> 1.12)
|
7
7
|
rest-client (~> 2.1)
|
@@ -26,59 +26,59 @@ GEM
|
|
26
26
|
http-accept (1.7.0)
|
27
27
|
http-cookie (1.0.4)
|
28
28
|
domain_name (~> 0.5)
|
29
|
-
i18n (1.
|
29
|
+
i18n (1.10.0)
|
30
30
|
concurrent-ruby (~> 1.0)
|
31
31
|
method_source (1.0.0)
|
32
32
|
mime-types (3.4.1)
|
33
33
|
mime-types-data (~> 3.2015)
|
34
|
-
mime-types-data (3.
|
34
|
+
mime-types-data (3.2022.0105)
|
35
35
|
netrc (0.11.0)
|
36
|
-
nokogiri (1.
|
36
|
+
nokogiri (1.13.3-x86_64-darwin)
|
37
37
|
racc (~> 1.4)
|
38
|
-
nokogiri (1.
|
38
|
+
nokogiri (1.13.3-x86_64-linux)
|
39
39
|
racc (~> 1.4)
|
40
40
|
parallel (1.21.0)
|
41
|
-
parser (3.
|
41
|
+
parser (3.1.1.0)
|
42
42
|
ast (~> 2.4.1)
|
43
43
|
pry (0.14.1)
|
44
44
|
coderay (~> 1.1)
|
45
45
|
method_source (~> 1.0)
|
46
46
|
public_suffix (4.0.6)
|
47
47
|
racc (1.6.0)
|
48
|
-
rainbow (3.
|
48
|
+
rainbow (3.1.1)
|
49
49
|
rake (13.0.6)
|
50
|
-
regexp_parser (2.2.
|
50
|
+
regexp_parser (2.2.1)
|
51
51
|
rest-client (2.1.0)
|
52
52
|
http-accept (>= 1.7.0, < 2.0)
|
53
53
|
http-cookie (>= 1.0.2, < 2.0)
|
54
54
|
mime-types (>= 1.16, < 4.0)
|
55
55
|
netrc (~> 0.8)
|
56
56
|
rexml (3.2.5)
|
57
|
-
rspec (3.
|
58
|
-
rspec-core (~> 3.
|
59
|
-
rspec-expectations (~> 3.
|
60
|
-
rspec-mocks (~> 3.
|
61
|
-
rspec-core (3.
|
62
|
-
rspec-support (~> 3.
|
63
|
-
rspec-expectations (3.
|
57
|
+
rspec (3.11.0)
|
58
|
+
rspec-core (~> 3.11.0)
|
59
|
+
rspec-expectations (~> 3.11.0)
|
60
|
+
rspec-mocks (~> 3.11.0)
|
61
|
+
rspec-core (3.11.0)
|
62
|
+
rspec-support (~> 3.11.0)
|
63
|
+
rspec-expectations (3.11.0)
|
64
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
-
rspec-support (~> 3.
|
66
|
-
rspec-mocks (3.
|
65
|
+
rspec-support (~> 3.11.0)
|
66
|
+
rspec-mocks (3.11.0)
|
67
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
-
rspec-support (~> 3.
|
69
|
-
rspec-support (3.
|
70
|
-
rubocop (1.
|
68
|
+
rspec-support (~> 3.11.0)
|
69
|
+
rspec-support (3.11.0)
|
70
|
+
rubocop (1.25.1)
|
71
71
|
parallel (~> 1.10)
|
72
|
-
parser (>= 3.
|
72
|
+
parser (>= 3.1.0.0)
|
73
73
|
rainbow (>= 2.2.2, < 4.0)
|
74
74
|
regexp_parser (>= 1.8, < 3.0)
|
75
75
|
rexml
|
76
|
-
rubocop-ast (>= 1.15.
|
76
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
77
77
|
ruby-progressbar (~> 1.7)
|
78
78
|
unicode-display_width (>= 1.4.0, < 3.0)
|
79
|
-
rubocop-ast (1.
|
80
|
-
parser (>= 3.
|
81
|
-
rubocop-rspec (2.
|
79
|
+
rubocop-ast (1.16.0)
|
80
|
+
parser (>= 3.1.1.0)
|
81
|
+
rubocop-rspec (2.9.0)
|
82
82
|
rubocop (~> 1.19)
|
83
83
|
ruby-progressbar (1.11.0)
|
84
84
|
rubyzip (2.3.2)
|
@@ -91,7 +91,7 @@ GEM
|
|
91
91
|
simplecov-html (~> 0.11)
|
92
92
|
simplecov_json_formatter (~> 0.1)
|
93
93
|
simplecov-html (0.12.3)
|
94
|
-
simplecov_json_formatter (0.1.
|
94
|
+
simplecov_json_formatter (0.1.4)
|
95
95
|
unf (0.1.4)
|
96
96
|
unf_ext
|
97
97
|
unf_ext (0.0.8)
|
@@ -6,7 +6,9 @@ module AtreaControl
|
|
6
6
|
class Unit
|
7
7
|
include AtreaControl::Logger
|
8
8
|
|
9
|
-
attr_reader :current_mode, :current_power, :outdoor_temperature
|
9
|
+
attr_reader :current_mode, :current_power, :outdoor_temperature, :preheat_temperature, :input_temperature
|
10
|
+
# @return [Boolean] preheating air is ON ?
|
11
|
+
attr_reader :preheating
|
10
12
|
# @return [DateTime] store time of last update
|
11
13
|
attr_reader :valid_for
|
12
14
|
# @return [UserCtrl]
|
@@ -35,6 +37,10 @@ module AtreaControl
|
|
35
37
|
current_power || values[:current_power]
|
36
38
|
end
|
37
39
|
|
40
|
+
def preheating?
|
41
|
+
preheating || values[:preheating]
|
42
|
+
end
|
43
|
+
|
38
44
|
# @param [String] value 0 - power-off; 1 - automat
|
39
45
|
def mode=(value)
|
40
46
|
v = [parser.input(@user_ctrl.sensors["mode_input"], value.to_s)]
|
@@ -47,8 +53,12 @@ module AtreaControl
|
|
47
53
|
write(v)
|
48
54
|
end
|
49
55
|
|
56
|
+
def parsed
|
57
|
+
parser.values(read.body)
|
58
|
+
end
|
59
|
+
|
50
60
|
def values
|
51
|
-
|
61
|
+
parsed.each do |name, value|
|
52
62
|
instance_variable_set :"@#{name}", value
|
53
63
|
end
|
54
64
|
as_json
|
@@ -59,6 +69,9 @@ module AtreaControl
|
|
59
69
|
current_mode: current_mode,
|
60
70
|
current_power: current_power,
|
61
71
|
outdoor_temperature: outdoor_temperature,
|
72
|
+
preheat_temperature: preheat_temperature,
|
73
|
+
input_temperature: input_temperature,
|
74
|
+
preheating: preheating,
|
62
75
|
valid_for: valid_for,
|
63
76
|
}
|
64
77
|
end
|
@@ -54,8 +54,14 @@ module AtreaControl
|
|
54
54
|
power_input = power.xpath("onchange").text[/getUrlPar\('(\w+)',val\)/, 1]
|
55
55
|
m = mode.xpath("onchange").text.match(/getUrlPar\('(\w+)',val\).*getUrlPar\(.(\w+).,2\)/)
|
56
56
|
|
57
|
+
preheat_temperature = user_ctrl.xpath("//body/content/i[@title='$requiredTemp']")
|
58
|
+
|
59
|
+
input_temp = user_ctrl.xpath("//body/content/i[@title='$inletTemp']") # "I10200"
|
60
|
+
input_temperature = input_temp.xpath("displayval").text[/val=values\.(\w\d+);/, 1]
|
57
61
|
@sensors = {
|
58
62
|
"outdoor_temperature" => outdoor_temp.attribute("id").value, # "I10208"
|
63
|
+
"preheat_temperature" => preheat_temperature.attribute("id").value, # "H10706"
|
64
|
+
"input_temperature" => input_temperature,
|
59
65
|
"current_power" => power.attribute("id").value, # "H10704"
|
60
66
|
"current_mode" => mode.attribute("id").value, # "H10705"
|
61
67
|
"current_mode_switch" => switch_mode, # "H10712"
|
@@ -30,16 +30,21 @@ module AtreaControl
|
|
30
30
|
# values[key]=values[key]/params[key].coef;
|
31
31
|
def parse(xml)
|
32
32
|
xml = Nokogiri::XML xml
|
33
|
-
@user_ctrl.sensors.transform_values do |id|
|
33
|
+
parsed = @user_ctrl.sensors.transform_values do |id|
|
34
34
|
# node = xml.xpath("//O[@I=\"#{id}\"]/@V").last
|
35
35
|
node = xml.xpath("//O[@I=\"#{id}\"]").last
|
36
|
-
logger.debug node.to_s
|
36
|
+
# logger.debug node.to_s
|
37
37
|
value = node.attribute("V").value.to_i
|
38
38
|
value -= 65_536 if value > 32_767
|
39
39
|
# value -= 0 if "offset"
|
40
40
|
# value = value / coef if "coef"
|
41
41
|
value
|
42
42
|
end
|
43
|
+
preheating = %w[C10200 C10202 C10215 C10217].any? do |i|
|
44
|
+
xml.xpath("//O[@I=\"#{i}\"]/@V").last&.value == "1"
|
45
|
+
end
|
46
|
+
parsed["preheating"] = preheating
|
47
|
+
parsed
|
43
48
|
end
|
44
49
|
|
45
50
|
# @param [Hash] values
|
@@ -49,6 +54,9 @@ module AtreaControl
|
|
49
54
|
"current_mode" => parse_current_mode(values),
|
50
55
|
"current_power" => values["current_power"].to_f,
|
51
56
|
"outdoor_temperature" => values["outdoor_temperature"].to_f / 10.0,
|
57
|
+
"preheat_temperature" => values["preheat_temperature"].to_f / 10.0,
|
58
|
+
"input_temperature" => values["input_temperature"].to_f / 10.0,
|
59
|
+
"preheating" => !!values["preheating"],
|
52
60
|
"valid_for" => Time.now,
|
53
61
|
}
|
54
62
|
end
|
@@ -58,10 +66,10 @@ module AtreaControl
|
|
58
66
|
# `current_mode_switch` = mode trigger by wall switch or something similar
|
59
67
|
# `current_mode` = is common "builtin" mode
|
60
68
|
def parse_current_mode(values)
|
61
|
-
if values[
|
62
|
-
@user_ctrl.user_modes[values[
|
69
|
+
if values["current_mode_switch"].positive?
|
70
|
+
@user_ctrl.user_modes[values["current_mode_switch"].to_s]
|
63
71
|
else
|
64
|
-
@user_ctrl.modes[values[
|
72
|
+
@user_ctrl.modes[values["current_mode"].to_s]
|
65
73
|
end
|
66
74
|
end
|
67
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atrea_control
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukáš Pokorný
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|