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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/atrea_control/duplex/login.rb +13 -0
- data/lib/atrea_control/duplex/unit.rb +7 -0
- data/lib/atrea_control/sensor_parser.rb +7 -2
- 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: 2a74f7162054ee182984e730f2d1459b911dfb8776300c2b568554be607a1add
|
4
|
+
data.tar.gz: 620367c6b128607aec63a52680bfd9b94376684ed0fa06f80b0f77032fc23e4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2d690b2bdac464a3b37015c54a1b326fbd6b21c6f67eb68cfb0e708e25018eee5e24ed8168796e6b051604f7ca06dc74eae5b5d2561280b538a09020807b65a
|
7
|
+
data.tar.gz: ccb084a5a96f23ae536068782bde603e23222949f03780493f868fa3f260fa85cb32daab8d5cac8a61cdc00bd57deacb9405910fcde8fdfa9fc5dec900bf2ec1
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
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
|
40
|
+
# value = value / coef if "coef"
|
36
41
|
value
|
37
42
|
end
|
38
43
|
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.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:
|
11
|
+
date: 2022-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|