waterfurnace_aurora 0.3.5 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/aurora_fetch +36 -9
- data/exe/aurora_mock +9 -5
- data/exe/aurora_monitor +10 -6
- data/exe/aurora_mqtt_bridge +10 -20
- data/lib/aurora/abc_client.rb +19 -0
- data/lib/aurora/modbus/slave.rb +2 -1
- data/lib/aurora/registers.rb +3 -0
- data/lib/aurora/version.rb +1 -1
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6920a48439c274a9c5f7cec06ebeabf6c97a91018f107d090ce8be793f307f99
|
4
|
+
data.tar.gz: 4a7e518fcca1ec7c52d7bd1bee6d294a59b31e9f0d759270a1a2bcd2f8c75270
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 504b790c101f15dc79f5985b3fdcab529f746d912aaef0865c59404240f95908ca72a70aa262af4917b7409ac9d5366f24167eddc33ba8ba5786d0213f7b3776
|
7
|
+
data.tar.gz: def8a5362616f511f514a0f3e3008302dfa0fa71d9e7ac4bd0d937cd76083ec6118cc8240e100bf5099cd610926dc912c8d4eaf50b4f7cb5149fcd5cdbbc88a8
|
data/exe/aurora_fetch
CHANGED
@@ -3,24 +3,51 @@
|
|
3
3
|
|
4
4
|
require "aurora"
|
5
5
|
require "ccutrer-serialport"
|
6
|
+
require "logger"
|
7
|
+
require "optparse"
|
6
8
|
require "uri"
|
7
9
|
|
10
|
+
debug_modbus = false
|
11
|
+
|
12
|
+
opts = OptionParser.new do |opts|
|
13
|
+
opts.banner = "Usage: aurora_fetch /path/to/serial/port REGISTERS [options]"
|
14
|
+
|
15
|
+
opts.on("--debug-modbus", "Print actual protocol bytes") { debug_modbus = true }
|
16
|
+
opts.on("-h", "--help", "Prints this help") do
|
17
|
+
puts opts
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
opts.parse!
|
23
|
+
|
24
|
+
unless ARGV.length == 2
|
25
|
+
puts opts
|
26
|
+
exit 1
|
27
|
+
end
|
28
|
+
|
8
29
|
uri = URI.parse(ARGV[0])
|
9
30
|
|
10
|
-
args =
|
31
|
+
args = case uri.scheme
|
32
|
+
when "tcp"
|
33
|
+
require "socket"
|
34
|
+
[TCPSocket.new(uri.host, uri.port)]
|
35
|
+
when "telnet", "rfc2217"
|
11
36
|
require "net/telnet/rfc2217"
|
12
|
-
[Net::Telnet::RFC2217.new(
|
13
|
-
|
14
|
-
|
15
|
-
|
37
|
+
[Net::Telnet::RFC2217.new(uri.host,
|
38
|
+
port: uri.port || 23,
|
39
|
+
baud: 19_200,
|
40
|
+
parity: :even)]
|
16
41
|
else
|
17
42
|
[CCutrer::SerialPort.new(uri.path, baud: 19_200, parity: :even)]
|
18
43
|
end
|
19
44
|
|
20
45
|
client = ModBus::RTUClient.new(*args)
|
21
|
-
client.logger = Logger.new($stdout
|
22
|
-
|
46
|
+
client.logger = Logger.new($stdout)
|
47
|
+
client.logger.level = debug_modbus ? :debug : :warn
|
23
48
|
|
24
|
-
|
49
|
+
slave = client.with_slave(1)
|
50
|
+
abc = Aurora::ABCClient.new(slave)
|
51
|
+
registers = abc.query_registers(ARGV[1])
|
25
52
|
|
26
|
-
puts registers
|
53
|
+
puts Aurora.print_registers(registers)
|
data/exe/aurora_mock
CHANGED
@@ -8,12 +8,16 @@ require "yaml"
|
|
8
8
|
|
9
9
|
uri = URI.parse(ARGV[0])
|
10
10
|
|
11
|
-
args =
|
11
|
+
args = case uri.scheme
|
12
|
+
when "tcp"
|
13
|
+
require "socket"
|
14
|
+
[TCPSocket.new(uri.host, uri.port)]
|
15
|
+
when "telnet", "rfc2217"
|
12
16
|
require "net/telnet/rfc2217"
|
13
|
-
[Net::Telnet::RFC2217.new(
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
[Net::Telnet::RFC2217.new(uri.host,
|
18
|
+
port: uri.port || 23,
|
19
|
+
baud: 19_200,
|
20
|
+
parity: :even)]
|
17
21
|
else
|
18
22
|
[CCutrer::SerialPort.new(uri.path, baud: 19_200, parity: :even)]
|
19
23
|
end
|
data/exe/aurora_monitor
CHANGED
@@ -36,12 +36,16 @@ last_registers = {}
|
|
36
36
|
SENSOR_REGISTERS = [16, 19, 20, 740, 900, 1109, 1105, 1106, 1107, 1108, 1110, 1111, 1114, 1117, 1134, 1147, 1149, 1151,
|
37
37
|
1153, 1165].freeze
|
38
38
|
|
39
|
-
args =
|
39
|
+
args = case uri.scheme
|
40
|
+
when "tcp"
|
41
|
+
require "socket"
|
42
|
+
[TCPSocket.new(uri.host, uri.port)]
|
43
|
+
when "telnet", "rfc2217"
|
40
44
|
require "net/telnet/rfc2217"
|
41
|
-
[Net::Telnet::RFC2217.new(
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
+
[Net::Telnet::RFC2217.new(uri.host,
|
46
|
+
port: uri.port || 23,
|
47
|
+
baud: 19_200,
|
48
|
+
parity: :even)]
|
45
49
|
else
|
46
50
|
[CCutrer::SerialPort.new(uri.path, baud: 19_200, parity: :even)]
|
47
51
|
end
|
@@ -49,7 +53,7 @@ args = if uri.scheme == "telnet" || uri.scheme == "rfc2217"
|
|
49
53
|
server = ModBus::RTUServer.new(*args)
|
50
54
|
server.promiscuous = true
|
51
55
|
server.logger = Logger.new($stdout)
|
52
|
-
server.logger.level = :debug
|
56
|
+
server.logger.level = debug_modbus ? :debug : :warn
|
53
57
|
|
54
58
|
diff_and_print = lambda do |registers|
|
55
59
|
registers = registers.slice(*(registers.keys - SENSOR_REGISTERS)) if ignore_sensors
|
data/exe/aurora_mqtt_bridge
CHANGED
@@ -10,12 +10,16 @@ require "aurora/core_ext/string"
|
|
10
10
|
uri = URI.parse(ARGV[0])
|
11
11
|
mqtt_uri = ARGV[1]
|
12
12
|
|
13
|
-
args =
|
13
|
+
args = case uri.scheme
|
14
|
+
when "tcp"
|
15
|
+
require "socket"
|
16
|
+
[TCPSocket.new(uri.host, uri.port)]
|
17
|
+
when "telnet", "rfc2217"
|
14
18
|
require "net/telnet/rfc2217"
|
15
|
-
[Net::Telnet::RFC2217.new(
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
[Net::Telnet::RFC2217.new(uri.host,
|
20
|
+
port: uri.port || 23,
|
21
|
+
baud: 19_200,
|
22
|
+
parity: :even)]
|
19
23
|
else
|
20
24
|
[CCutrer::SerialPort.new(uri.path, baud: 19_200, parity: :even)]
|
21
25
|
end
|
@@ -33,21 +37,7 @@ class MQTTBridge
|
|
33
37
|
@mutex.synchronize do
|
34
38
|
case topic
|
35
39
|
when /\$modbus$/
|
36
|
-
|
37
|
-
case addr
|
38
|
-
when "known"
|
39
|
-
Aurora::REGISTER_NAMES.keys
|
40
|
-
when /^(\d+)(?:\.\.|-)(\d+)$/
|
41
|
-
$1.to_i..$2.to_i
|
42
|
-
else
|
43
|
-
addr.to_i
|
44
|
-
end
|
45
|
-
end
|
46
|
-
queries = Aurora.normalize_ranges(query)
|
47
|
-
registers = {}
|
48
|
-
queries.each do |subquery|
|
49
|
-
registers.merge!(@abc.modbus_slave.read_multiple_holding_registers(*subquery))
|
50
|
-
end
|
40
|
+
registers = @abc.query_registers(value)
|
51
41
|
Aurora.print_registers(registers) do |register, v|
|
52
42
|
@homie.mqtt.publish("#{@homie.topic}/$modbus/#{register}", v, retain: false, qos: 1)
|
53
43
|
end
|
data/lib/aurora/abc_client.rb
CHANGED
@@ -42,6 +42,25 @@ module Aurora
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def query_registers(query)
|
46
|
+
ranges = query.split(",").map do |addr|
|
47
|
+
case addr
|
48
|
+
when "known"
|
49
|
+
Aurora::REGISTER_NAMES.keys
|
50
|
+
when /^(\d+)(?:\.\.|-)(\d+)$/
|
51
|
+
$1.to_i..$2.to_i
|
52
|
+
else
|
53
|
+
addr.to_i
|
54
|
+
end
|
55
|
+
end
|
56
|
+
queries = Aurora.normalize_ranges(ranges)
|
57
|
+
registers = {}
|
58
|
+
queries.each do |subquery|
|
59
|
+
registers.merge!(@modbus_slave.read_multiple_holding_registers(*subquery))
|
60
|
+
end
|
61
|
+
registers
|
62
|
+
end
|
63
|
+
|
45
64
|
def refresh
|
46
65
|
registers_to_read = [19..20, 30, 340, 344, 347, 740..741, 900, 1110..1111, 1114, 1117, 1147..1153, 1165, 3027,
|
47
66
|
31_003]
|
data/lib/aurora/modbus/slave.rb
CHANGED
@@ -49,7 +49,8 @@ module Aurora
|
|
49
49
|
when 0x80..0xff
|
50
50
|
msg += read(io, 3)
|
51
51
|
else
|
52
|
-
|
52
|
+
log "Rx (#{msg.size} bytes): " + logging_bytes(msg)
|
53
|
+
raise ::ModBus::Errors::IllegalFunction, "Illegal function: #{function_code}"
|
53
54
|
end
|
54
55
|
msg
|
55
56
|
end
|
data/lib/aurora/registers.rb
CHANGED
@@ -594,7 +594,10 @@ module Aurora
|
|
594
594
|
12_619 => "Heating Setpoint (write)",
|
595
595
|
12_620 => "Cooling Setpoint (write)",
|
596
596
|
12_621 => "Fan Mode (write)",
|
597
|
+
3000 => "Compressor Speed?",
|
598
|
+
3001 => "Compressor Speed?",
|
597
599
|
3027 => "Compressor Speed",
|
600
|
+
3904 => "Leaving Air Temperature?",
|
598
601
|
31_003 => "Outdoor Temp",
|
599
602
|
31_005 => "IZ2 Demand",
|
600
603
|
31_109 => "Humidifier Mode", # write to 21114
|
data/lib/aurora/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waterfurnace_aurora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ccutrer-serialport
|
@@ -44,14 +44,20 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '1.0'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 1.0.1
|
48
51
|
type: :runtime
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
55
|
- - "~>"
|
53
56
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
57
|
+
version: '1.0'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 1.0.1
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rmodbus-ccutrer
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|