waterfurnace_aurora 0.3.4 → 0.3.8
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 +12 -9
- data/exe/aurora_mock +9 -5
- data/exe/aurora_monitor +10 -6
- data/exe/aurora_mqtt_bridge +34 -45
- data/lib/aurora/abc_client.rb +42 -6
- data/lib/aurora/modbus/slave.rb +1 -1
- data/lib/aurora/registers.rb +13 -5
- 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: c36888a334377168fdfcdc0ef75481925b0249b19d62cae4c381a2dc13b1f80f
|
4
|
+
data.tar.gz: 1533ce2068ba912e12110b6c094b2431fbd8e80593a06b5c9378634ef6418413
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cd4b65faa764dab63a662023710324ffe20874e11c565fab5bd5be30d4edce6d593266cc4ae688d3181f345a2d179d733d74b49524e2581bb26718dc64f2ebf
|
7
|
+
data.tar.gz: 0d6e3ab96d4de61d16c4c4f8e1667b98535a2c95d1c053a836d0107c16a854182bdc259af1905ac85e08ecd88b73c03076d355032f4832a21aa9c47729ff6209
|
data/exe/aurora_fetch
CHANGED
@@ -7,20 +7,23 @@ require "uri"
|
|
7
7
|
|
8
8
|
uri = URI.parse(ARGV[0])
|
9
9
|
|
10
|
-
args =
|
10
|
+
args = case uri.scheme
|
11
|
+
when "tcp"
|
12
|
+
require "socket"
|
13
|
+
[TCPSocket.new(uri.host, uri.port)]
|
14
|
+
when "telnet", "rfc2217"
|
11
15
|
require "net/telnet/rfc2217"
|
12
|
-
[Net::Telnet::RFC2217.new(
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
[Net::Telnet::RFC2217.new(uri.host,
|
17
|
+
port: uri.port || 23,
|
18
|
+
baud: 19_200,
|
19
|
+
parity: :even)]
|
16
20
|
else
|
17
21
|
[CCutrer::SerialPort.new(uri.path, baud: 19_200, parity: :even)]
|
18
22
|
end
|
19
23
|
|
20
24
|
client = ModBus::RTUClient.new(*args)
|
21
|
-
client.logger = Logger.new($stdout, :debug)
|
22
25
|
slave = client.with_slave(1)
|
26
|
+
abc = Aurora::ABCClient.new(slave)
|
27
|
+
registers = abc.query_registers(ARGV[1])
|
23
28
|
|
24
|
-
|
25
|
-
|
26
|
-
puts registers.inspect
|
29
|
+
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,32 +37,23 @@ class MQTTBridge
|
|
33
37
|
@mutex.synchronize do
|
34
38
|
case topic
|
35
39
|
when /\$modbus$/
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
Aurora::REGISTER_NAMES.keys
|
40
|
-
when /^(\d+)\.\.(\d+)$/
|
41
|
-
Regexp.last_match(1).to_i..Regexp.last_match(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))
|
40
|
+
registers = @abc.query_registers(value)
|
41
|
+
Aurora.print_registers(registers) do |register, v|
|
42
|
+
@homie.mqtt.publish("#{@homie.topic}/$modbus/#{register}", v, retain: false, qos: 1)
|
50
43
|
end
|
51
|
-
|
52
|
-
|
53
|
-
when %r{\$modbus/(\d+)$}
|
54
|
-
register = Regexp.last_match(1).to_i
|
44
|
+
when %r{\$modbus/(\d+)/set$}
|
45
|
+
register = $1.to_i
|
55
46
|
value = case value
|
56
47
|
when /\d+/
|
57
48
|
value.to_i
|
58
49
|
when /0x(\d+)/
|
59
|
-
|
50
|
+
$1.to_i(16)
|
60
51
|
end
|
61
52
|
@abc.modbus_slave.holding_registers[register] = value if value
|
53
|
+
registers = { register => @abc.modbus_slave.holding_registers[register] }
|
54
|
+
Aurora.print_registers(registers) do |r, v|
|
55
|
+
@homie.mqtt.publish("#{@homie.topic}/$modbus/#{r}", v, retain: false, qos: 1)
|
56
|
+
end
|
62
57
|
end
|
63
58
|
end
|
64
59
|
rescue StandardError => e
|
@@ -72,25 +67,8 @@ class MQTTBridge
|
|
72
67
|
begin
|
73
68
|
@mutex.synchronize do
|
74
69
|
@abc.refresh
|
75
|
-
|
76
|
-
|
77
|
-
dhw_water_temperature
|
78
|
-
entering_air_temperature
|
79
|
-
entering_water_temperature
|
80
|
-
fan_speed
|
81
|
-
leaving_air_temperature
|
82
|
-
leaving_water_temperature
|
83
|
-
outdoor_temperature
|
84
|
-
relative_humidity
|
85
|
-
waterflow
|
86
|
-
fp1
|
87
|
-
fp2
|
88
|
-
compressor_watts
|
89
|
-
blower_watts
|
90
|
-
aux_heat_watts
|
91
|
-
loop_pump_watts
|
92
|
-
total_watts].each do |property|
|
93
|
-
@homie_abc[property.to_s.tr("_", "-")].value = @abc.public_send(property)
|
70
|
+
@homie_abc.each do |property|
|
71
|
+
property.value = @abc.public_send(property.id.tr("-", "_"))
|
94
72
|
end
|
95
73
|
|
96
74
|
@abc.zones.each_with_index do |z, idx|
|
@@ -123,7 +101,9 @@ class MQTTBridge
|
|
123
101
|
unit: "ºF")
|
124
102
|
node.property("leaving-water-temperature", "Leaving Water Temperature", :float, @abc.leaving_water_temperature,
|
125
103
|
unit: "ºF")
|
126
|
-
|
104
|
+
unless @abc.outdoor_temperature.zero? # TODO: figure out the config if this actually exists
|
105
|
+
node.property("outdoor-temperature", "Outdoor Temperature", :float, @abc.outdoor_temperature, unit: "ºF")
|
106
|
+
end
|
127
107
|
node.property("relative-humidity", "Relative Humidity", :integer, @abc.relative_humidity, unit: "%",
|
128
108
|
format: 0..100)
|
129
109
|
node.property("waterflow", "Waterflow", :float, unit: "gpm")
|
@@ -134,6 +114,15 @@ class MQTTBridge
|
|
134
114
|
node.property(component.tr("_", "-"), component.tr("_", " ").titleize, :integer,
|
135
115
|
@abc.public_send(component), unit: "W")
|
136
116
|
end
|
117
|
+
|
118
|
+
node.property("blower-only-ecm-speed", "Blower Only ECM Speed", :integer, @abc.blower_only_ecm_speed,
|
119
|
+
format: 1..12) do |value, property|
|
120
|
+
@mutex.synchronize { property.value = @abc.blower_only_ecm_speed = value }
|
121
|
+
end
|
122
|
+
node.property("aux-heat-ecm-speed", "Aux Heat ECM Speed", :integer, @abc.aux_heat_ecm_speed,
|
123
|
+
format: 1..12) do |value, property|
|
124
|
+
@mutex.synchronize { property.value = @abc.aux_heat_ecm_speed = value }
|
125
|
+
end
|
137
126
|
end
|
138
127
|
|
139
128
|
@abc.zones.each_with_index do |zone, i|
|
@@ -183,7 +172,7 @@ class MQTTBridge
|
|
183
172
|
|
184
173
|
# direct access to modbus registers for debugging purposes
|
185
174
|
@homie.mqtt.subscribe("#{@homie.topic}/$modbus")
|
186
|
-
@homie.mqtt.subscribe("#{@homie.topic}/$modbus
|
175
|
+
@homie.mqtt.subscribe("#{@homie.topic}/$modbus/+/set")
|
187
176
|
@homie.publish
|
188
177
|
end
|
189
178
|
end
|
data/lib/aurora/abc_client.rb
CHANGED
@@ -18,6 +18,8 @@ module Aurora
|
|
18
18
|
:outdoor_temperature,
|
19
19
|
:fp1,
|
20
20
|
:fp2,
|
21
|
+
:blower_only_ecm_speed,
|
22
|
+
:aux_heat_ecm_speed,
|
21
23
|
:compressor_watts,
|
22
24
|
:blower_watts,
|
23
25
|
:aux_heat_watts,
|
@@ -31,17 +33,37 @@ module Aurora
|
|
31
33
|
registers_array = @modbus_slave.holding_registers[105...110]
|
32
34
|
registers = registers_array.each_with_index.map { |r, i| [i + 105, r] }.to_h
|
33
35
|
@serial_number = Aurora.transform_registers(registers)[105]
|
34
|
-
|
35
|
-
|
36
|
-
@zones = if iz2_zone_count > 1
|
37
|
-
(0...iz2_zone_count).map { |i| IZ2Zone.new(self, i + 1) }
|
38
|
-
else
|
36
|
+
|
37
|
+
@zones = if @modbus_slave.holding_registers[813].zero?
|
39
38
|
[Thermostat.new(self)]
|
39
|
+
else
|
40
|
+
iz2_zone_count = @modbus_slave.holding_registers[483]
|
41
|
+
(0...iz2_zone_count).map { |i| IZ2Zone.new(self, i + 1) }
|
40
42
|
end
|
41
43
|
end
|
42
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
|
+
|
43
64
|
def refresh
|
44
|
-
registers_to_read = [19..20, 30, 344, 740..741, 900, 1110..1111, 1114, 1117, 1147..1153, 1165, 3027,
|
65
|
+
registers_to_read = [19..20, 30, 340, 344, 347, 740..741, 900, 1110..1111, 1114, 1117, 1147..1153, 1165, 3027,
|
66
|
+
31_003]
|
45
67
|
if zones.first.is_a?(IZ2Zone)
|
46
68
|
zones.each_with_index do |_z, i|
|
47
69
|
base1 = 21_203 + i * 9
|
@@ -71,6 +93,8 @@ module Aurora
|
|
71
93
|
@fp1 = registers[19]
|
72
94
|
@fp2 = registers[20]
|
73
95
|
@locked_out = registers[1117]
|
96
|
+
@blower_only_ecm_speed = registers[340]
|
97
|
+
@aux_heat_ecm_speed = registers[347]
|
74
98
|
@compressor_watts = registers[1147]
|
75
99
|
@blower_watts = registers[1149]
|
76
100
|
@aux_heat_watts = registers[1151]
|
@@ -99,6 +123,18 @@ module Aurora
|
|
99
123
|
end
|
100
124
|
end
|
101
125
|
|
126
|
+
def blower_only_ecm_speed=(value)
|
127
|
+
return unless (1..12).include?(value)
|
128
|
+
|
129
|
+
@modbus_slave.holding_registers[340] = value
|
130
|
+
end
|
131
|
+
|
132
|
+
def aux_heat_ecm_speed=(value)
|
133
|
+
return unless (1..12).include?(value)
|
134
|
+
|
135
|
+
@modbus_slave.holding_registers[347] = value
|
136
|
+
end
|
137
|
+
|
102
138
|
def inspect
|
103
139
|
"#<Aurora::ABCClient #{(instance_variables - [:@modbus_slave]).map do |iv|
|
104
140
|
"#{iv}=#{instance_variable_get(iv).inspect}"
|
data/lib/aurora/modbus/slave.rb
CHANGED
data/lib/aurora/registers.rb
CHANGED
@@ -497,7 +497,7 @@ module Aurora
|
|
497
497
|
REGISTER_NAMES = {
|
498
498
|
1 => "Random Start Delay",
|
499
499
|
2 => "ABC Program Version",
|
500
|
-
3 => "
|
500
|
+
3 => "??? Version?",
|
501
501
|
4 => "DIP Switch Override",
|
502
502
|
6 => "Compressor Anti-Short Cycle Delay",
|
503
503
|
8 => "Unit Type?",
|
@@ -563,7 +563,7 @@ module Aurora
|
|
563
563
|
746 => "Cooling Set Point",
|
564
564
|
747 => "Ambient Temperature",
|
565
565
|
807 => "AXB Version",
|
566
|
-
813 => "IZ2 Version
|
566
|
+
813 => "IZ2 Version",
|
567
567
|
816 => "AOC Version 1?",
|
568
568
|
817 => "AOC Version 2?",
|
569
569
|
819 => "MOC Version 1?",
|
@@ -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
|
@@ -648,7 +651,7 @@ module Aurora
|
|
648
651
|
end
|
649
652
|
|
650
653
|
def print_registers(registers)
|
651
|
-
result = []
|
654
|
+
result = [] unless block_given?
|
652
655
|
registers.each do |(k, value)|
|
653
656
|
# ignored
|
654
657
|
next if REGISTER_NAMES.key?(k) && REGISTER_NAMES[k].nil?
|
@@ -665,8 +668,13 @@ module Aurora
|
|
665
668
|
|
666
669
|
name ||= "???"
|
667
670
|
|
668
|
-
|
671
|
+
full_value = "#{name} (#{k}): #{value}"
|
672
|
+
if block_given?
|
673
|
+
yield(k, full_value)
|
674
|
+
else
|
675
|
+
result << full_value
|
676
|
+
end
|
669
677
|
end
|
670
|
-
result.join("\n")
|
678
|
+
result.join("\n") unless block_given?
|
671
679
|
end
|
672
680
|
end
|
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.8
|
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
|