atrea_control 2.0.1 → 2.0.2

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: 2a74f7162054ee182984e730f2d1459b911dfb8776300c2b568554be607a1add
4
+ data.tar.gz: 620367c6b128607aec63a52680bfd9b94376684ed0fa06f80b0f77032fc23e4b
5
5
  SHA512:
6
- metadata.gz: 807dc186b9810f869df2f9c6ad40b9f15fbbb33a85bfcea73a634a396b15a12e9e7060da2d2e76380789158280ee95313303a5f8b6c2e811b58a242fa3d9f950
7
- data.tar.gz: 55a2c020ad45023c840a5f1734146dc4159849fdc667f91d9dc6c16d16359554dcd374e76be95bfa8852fcf3e1435ed20ea838a507e15ff5b50fd811b7814fd2
6
+ metadata.gz: b2d690b2bdac464a3b37015c54a1b326fbd6b21c6f67eb68cfb0e708e25018eee5e24ed8168796e6b051604f7ca06dc74eae5b5d2561280b538a09020807b65a
7
+ data.tar.gz: ccb084a5a96f23ae536068782bde603e23222949f03780493f868fa3f260fa85cb32daab8d5cac8a61cdc00bd57deacb9405910fcde8fdfa9fc5dec900bf2ec1
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
1
  ## [Unreleased]
2
+
3
+ ## [2.0.2] - 2022-01-20
4
+ ### Added
5
+ - debug unit values
6
+ - try token-based login (without success)
7
+
2
8
  ## [2.0.1] - 2021-12-26
3
9
  ### Fixed
4
10
  - write correct arguments
@@ -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
@@ -67,6 +67,13 @@ module AtreaControl
67
67
  values.to_json(*args)
68
68
  end
69
69
 
70
+ # Additional "parameters" for each sensors
71
+ # @note its changed in time ?
72
+ def params
73
+ response = request.call(_t: "user/params.xml")
74
+ Nokogiri::XML response.body
75
+ end
76
+
70
77
  private
71
78
 
72
79
  def parser
@@ -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
@@ -29,10 +31,13 @@ module AtreaControl
29
31
  def parse(xml)
30
32
  xml = Nokogiri::XML xml
31
33
  @user_ctrl.sensors.transform_values do |id|
32
- value = xml.xpath("//O[@I=\"#{id}\"]/@V").last&.value.to_i
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
38
43
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AtreaControl
4
4
 
5
- VERSION = "2.0.1"
5
+ VERSION = "2.0.2"
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.0.2
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-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n