atrea_control 2.0.1 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d02f9e12d50a1306027858699f71f71435f5f9bd393eb20e157b649ad7111ee
4
- data.tar.gz: ef9a19f18361713356cd28d5a6ecd5ff634fd82e703bf9073fba9d2763703dcc
3
+ metadata.gz: de4b8916b41e5f8089e213a57af22064c85e4cfd21b169b4cbb8a31bf0959006
4
+ data.tar.gz: e90ea88c74d8602e8add47e0284fa3313b2e11ca085e0bedba8efe010c26e9ff
5
5
  SHA512:
6
- metadata.gz: 807dc186b9810f869df2f9c6ad40b9f15fbbb33a85bfcea73a634a396b15a12e9e7060da2d2e76380789158280ee95313303a5f8b6c2e811b58a242fa3d9f950
7
- data.tar.gz: 55a2c020ad45023c840a5f1734146dc4159849fdc667f91d9dc6c16d16359554dcd374e76be95bfa8852fcf3e1435ed20ea838a507e15ff5b50fd811b7814fd2
6
+ metadata.gz: 17b48f07d42c1d90d3ccca8f2d4de0080d50a7528dc194ecd5ca41affcb0e15b6c1aeefed3e85930119bd5f33e7315d23bae1ff73b19086f671cad7eadc60bcc
7
+ data.tar.gz: 933ded9e14e5f8a6e1e67ad1621bea251b37c2c27c7f1a6b9ca063c4f0544b5db088821651096eb0050bb51cdb9b49c6a675b603e91340ed38e6f44d6edd3c4d
data/CHANGELOG.md CHANGED
@@ -1,4 +1,24 @@
1
1
  ## [Unreleased]
2
+
3
+ ## [2.1.1] - 2022-08-21
4
+ ### Fixed
5
+ - override "schedule program" by "temporary"
6
+ ### Changed
7
+ - dependencies update
8
+
9
+ ## [2.1.0] - 2022-02-28
10
+ ### Added
11
+ - preheating is ON ?
12
+ - heat temperature
13
+ - current input temperature
14
+ ### Removed
15
+ - debug
16
+
17
+ ## [2.0.2] - 2022-01-20
18
+ ### Added
19
+ - debug unit values
20
+ - try token-based login (without success)
21
+
2
22
  ## [2.0.1] - 2021-12-26
3
23
  ### Fixed
4
24
  - write correct arguments
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- atrea_control (2.0.1)
4
+ atrea_control (2.1.0)
5
5
  i18n (~> 1.8)
6
6
  nokogiri (~> 1.12)
7
7
  rest-client (~> 2.1)
@@ -10,12 +10,12 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- addressable (2.8.0)
14
- public_suffix (>= 2.0.2, < 5.0)
13
+ addressable (2.8.1)
14
+ public_suffix (>= 2.0.2, < 6.0)
15
15
  ast (2.4.2)
16
16
  childprocess (4.1.0)
17
17
  coderay (1.1.3)
18
- concurrent-ruby (1.1.9)
18
+ concurrent-ruby (1.1.10)
19
19
  crack (0.4.5)
20
20
  rexml
21
21
  diff-lcs (1.5.0)
@@ -24,85 +24,90 @@ GEM
24
24
  unf (>= 0.0.5, < 1.0.0)
25
25
  hashdiff (1.0.1)
26
26
  http-accept (1.7.0)
27
- http-cookie (1.0.4)
27
+ http-cookie (1.0.5)
28
28
  domain_name (~> 0.5)
29
- i18n (1.8.11)
29
+ i18n (1.12.0)
30
30
  concurrent-ruby (~> 1.0)
31
+ json (2.6.2)
31
32
  method_source (1.0.0)
32
33
  mime-types (3.4.1)
33
34
  mime-types-data (~> 3.2015)
34
- mime-types-data (3.2021.1115)
35
+ mime-types-data (3.2022.0105)
35
36
  netrc (0.11.0)
36
- nokogiri (1.12.5-x86_64-darwin)
37
+ nokogiri (1.13.8-x86_64-darwin)
37
38
  racc (~> 1.4)
38
- nokogiri (1.12.5-x86_64-linux)
39
+ nokogiri (1.13.8-x86_64-linux)
39
40
  racc (~> 1.4)
40
- parallel (1.21.0)
41
- parser (3.0.3.2)
41
+ parallel (1.22.1)
42
+ parser (3.1.2.1)
42
43
  ast (~> 2.4.1)
43
44
  pry (0.14.1)
44
45
  coderay (~> 1.1)
45
46
  method_source (~> 1.0)
46
- public_suffix (4.0.6)
47
+ public_suffix (5.0.0)
47
48
  racc (1.6.0)
48
- rainbow (3.0.0)
49
+ rainbow (3.1.1)
49
50
  rake (13.0.6)
50
- regexp_parser (2.2.0)
51
+ regexp_parser (2.5.0)
51
52
  rest-client (2.1.0)
52
53
  http-accept (>= 1.7.0, < 2.0)
53
54
  http-cookie (>= 1.0.2, < 2.0)
54
55
  mime-types (>= 1.16, < 4.0)
55
56
  netrc (~> 0.8)
56
57
  rexml (3.2.5)
57
- rspec (3.10.0)
58
- rspec-core (~> 3.10.0)
59
- rspec-expectations (~> 3.10.0)
60
- rspec-mocks (~> 3.10.0)
61
- rspec-core (3.10.1)
62
- rspec-support (~> 3.10.0)
63
- rspec-expectations (3.10.1)
58
+ rspec (3.11.0)
59
+ rspec-core (~> 3.11.0)
60
+ rspec-expectations (~> 3.11.0)
61
+ rspec-mocks (~> 3.11.0)
62
+ rspec-core (3.11.0)
63
+ rspec-support (~> 3.11.0)
64
+ rspec-expectations (3.11.0)
64
65
  diff-lcs (>= 1.2.0, < 2.0)
65
- rspec-support (~> 3.10.0)
66
- rspec-mocks (3.10.2)
66
+ rspec-support (~> 3.11.0)
67
+ rspec-mocks (3.11.1)
67
68
  diff-lcs (>= 1.2.0, < 2.0)
68
- rspec-support (~> 3.10.0)
69
- rspec-support (3.10.3)
70
- rubocop (1.24.0)
69
+ rspec-support (~> 3.11.0)
70
+ rspec-support (3.11.0)
71
+ rubocop (1.35.0)
72
+ json (~> 2.3)
71
73
  parallel (~> 1.10)
72
- parser (>= 3.0.0.0)
74
+ parser (>= 3.1.2.1)
73
75
  rainbow (>= 2.2.2, < 4.0)
74
76
  regexp_parser (>= 1.8, < 3.0)
75
- rexml
76
- rubocop-ast (>= 1.15.0, < 2.0)
77
+ rexml (>= 3.2.5, < 4.0)
78
+ rubocop-ast (>= 1.20.1, < 2.0)
77
79
  ruby-progressbar (~> 1.7)
78
80
  unicode-display_width (>= 1.4.0, < 3.0)
79
- rubocop-ast (1.15.0)
80
- parser (>= 3.0.1.1)
81
- rubocop-rspec (2.6.0)
82
- rubocop (~> 1.19)
81
+ rubocop-ast (1.21.0)
82
+ parser (>= 3.1.1.0)
83
+ rubocop-rspec (2.12.1)
84
+ rubocop (~> 1.31)
83
85
  ruby-progressbar (1.11.0)
84
86
  rubyzip (2.3.2)
85
- selenium-webdriver (4.1.0)
87
+ selenium-webdriver (4.4.0)
86
88
  childprocess (>= 0.5, < 5.0)
87
89
  rexml (~> 3.2, >= 3.2.5)
88
- rubyzip (>= 1.2.2)
90
+ rubyzip (>= 1.2.2, < 3.0)
91
+ websocket (~> 1.0)
89
92
  simplecov (0.21.2)
90
93
  docile (~> 1.1)
91
94
  simplecov-html (~> 0.11)
92
95
  simplecov_json_formatter (~> 0.1)
93
96
  simplecov-html (0.12.3)
94
- simplecov_json_formatter (0.1.3)
97
+ simplecov_json_formatter (0.1.4)
95
98
  unf (0.1.4)
96
99
  unf_ext
97
- unf_ext (0.0.8)
98
- unicode-display_width (2.1.0)
99
- webmock (3.14.0)
100
+ unf_ext (0.0.8.2)
101
+ unicode-display_width (2.2.0)
102
+ webmock (3.18.1)
100
103
  addressable (>= 2.8.0)
101
104
  crack (>= 0.3.2)
102
105
  hashdiff (>= 0.4.0, < 2.0.0)
106
+ websocket (1.2.9)
103
107
 
104
108
  PLATFORMS
105
109
  x86_64-darwin-19
110
+ x86_64-darwin-20
106
111
  x86_64-linux
107
112
 
108
113
  DEPENDENCIES
@@ -116,4 +121,4 @@ DEPENDENCIES
116
121
  webmock (~> 3.14)
117
122
 
118
123
  BUNDLED WITH
119
- 2.2.17
124
+ 2.3.11
@@ -1,3 +1,5 @@
1
+ require "digest"
2
+ require "rest-client"
1
3
  require "selenium-webdriver"
2
4
 
3
5
  module AtreaControl
@@ -23,6 +25,17 @@ module AtreaControl
23
25
  @login = login
24
26
  @password = password
25
27
  end
28
+ #
29
+ # def crypto_password
30
+ # md5 = Digest::MD5.new
31
+ # md5 << "\r\n"
32
+ # md5 << @password
33
+ # md5.hexdigest
34
+ # end
35
+ #
36
+ # def token
37
+ # RestClient.get "#{AtreaControl::Duplex::CONTROL_URI}/config/login.cgi", params: { magic: crypto_password }
38
+ # end
26
39
 
27
40
  def user
28
41
  raise AtreaControl::Error, "Must be logged in" unless login
@@ -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)]
@@ -43,12 +49,18 @@ module AtreaControl
43
49
  end
44
50
 
45
51
  def power=(value)
46
- v = parser.input(@user_ctrl.sensors["power_input"], value.to_s)
47
- write(v)
52
+ v = [parser.input(@user_ctrl.sensors["power_input"], value.to_s)]
53
+ # overtake schedule control
54
+ v << "H1070000002" if value.to_i.positive?
55
+ write(*v)
56
+ end
57
+
58
+ def parsed
59
+ parser.values(read.body)
48
60
  end
49
61
 
50
62
  def values
51
- parser.values(read.body).each do |name, value|
63
+ parsed.each do |name, value|
52
64
  instance_variable_set :"@#{name}", value
53
65
  end
54
66
  as_json
@@ -59,6 +71,9 @@ module AtreaControl
59
71
  current_mode: current_mode,
60
72
  current_power: current_power,
61
73
  outdoor_temperature: outdoor_temperature,
74
+ preheat_temperature: preheat_temperature,
75
+ input_temperature: input_temperature,
76
+ preheating: preheating,
62
77
  valid_for: valid_for,
63
78
  }
64
79
  end
@@ -67,6 +82,13 @@ module AtreaControl
67
82
  values.to_json(*args)
68
83
  end
69
84
 
85
+ # Additional "parameters" for each sensors
86
+ # @note its changed in time ?
87
+ def params
88
+ response = request.call(_t: "user/params.xml")
89
+ Nokogiri::XML response.body
90
+ end
91
+
70
92
  private
71
93
 
72
94
  def parser
@@ -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"
@@ -6,6 +6,8 @@ module AtreaControl
6
6
  # Call RD5 unit ang get current sensors values
7
7
  # parse it and return Hash
8
8
  class SensorParser
9
+ include AtreaControl::Logger
10
+
9
11
  # @param [AtreaControl::Duplex::UserCtrl] user_ctrl
10
12
  def initialize(user_ctrl)
11
13
  @user_ctrl = user_ctrl
@@ -28,13 +30,21 @@ module AtreaControl
28
30
  # values[key]=values[key]/params[key].coef;
29
31
  def parse(xml)
30
32
  xml = Nokogiri::XML xml
31
- @user_ctrl.sensors.transform_values do |id|
32
- value = xml.xpath("//O[@I=\"#{id}\"]/@V").last&.value.to_i
33
+ parsed = @user_ctrl.sensors.transform_values do |id|
34
+ # node = xml.xpath("//O[@I=\"#{id}\"]/@V").last
35
+ node = xml.xpath("//O[@I=\"#{id}\"]").last
36
+ # logger.debug node.to_s
37
+ value = node.attribute("V").value.to_i
33
38
  value -= 65_536 if value > 32_767
34
39
  # value -= 0 if "offset"
35
- # value -= 0 if "coef"
40
+ # value = value / coef if "coef"
36
41
  value
37
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
38
48
  end
39
49
 
40
50
  # @param [Hash] values
@@ -44,6 +54,9 @@ module AtreaControl
44
54
  "current_mode" => parse_current_mode(values),
45
55
  "current_power" => values["current_power"].to_f,
46
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"],
47
60
  "valid_for" => Time.now,
48
61
  }
49
62
  end
@@ -53,10 +66,10 @@ module AtreaControl
53
66
  # `current_mode_switch` = mode trigger by wall switch or something similar
54
67
  # `current_mode` = is common "builtin" mode
55
68
  def parse_current_mode(values)
56
- if values['current_mode_switch'].positive?
57
- @user_ctrl.user_modes[values['current_mode_switch'].to_s]
69
+ if values["current_mode_switch"].positive?
70
+ @user_ctrl.user_modes[values["current_mode_switch"].to_s]
58
71
  else
59
- @user_ctrl.modes[values['current_mode'].to_s]
72
+ @user_ctrl.modes[values["current_mode"].to_s]
60
73
  end
61
74
  end
62
75
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AtreaControl
4
4
 
5
- VERSION = "2.0.1"
5
+ VERSION = "2.1.1"
6
6
 
7
7
  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.1
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukáš Pokorný
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-25 00:00:00.000000000 Z
11
+ date: 2022-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.1.4
121
+ rubygems_version: 3.3.11
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Get data control.atrea.eu