waterfurnace_aurora 0.4.1 → 0.4.5

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: a429ac21f24ff82252a574e3e9bcd5c1c02c5d819f236f1b2fe05d1517a9039a
4
- data.tar.gz: ce6bd7dae57e4d2862191ce2c65e9483655aa489ee4b03824457709fea73a6ec
3
+ metadata.gz: 792824de511d596a9c0cacc0ef0eae5385e0ec72e4c9da1765292d4825256769
4
+ data.tar.gz: 9cbd94692b1074e7430e6089348d07d5a31506f6e679d82aaa8762316efbf634
5
5
  SHA512:
6
- metadata.gz: 5cef31050d0c211a6fce8f22a47f0a09e5bc17c09f685b45a52faccd39b4bbc40413822abcdc78e0b272b35648672457f3e2880c44d7664c2f6d88ec75fc9437
7
- data.tar.gz: 45861b6d6a49dc88f68a9f7ca4b3d5ac15517cbe413b6f5dfd8578963df65b9fc14f6fbd44101b773137269f25a6f06acb6901f1b409067d9f99e81c8bf38af7
6
+ metadata.gz: cec2a4f8ef4353a3c824af4d701dc6fe8ccc904d2ead6176b3507828023430ff335a6d2f2a5132e764d21adf8242973677d0b857079c74f16e8b49ae14a45977
7
+ data.tar.gz: c52dfdbc4e6e18c636c3e61226b11f7b4cc056fd76413794a41235936783f07ea09f46db77a901c02957a50ba82555cf35e84794c8903d73b00cf2fd830b480b
data/exe/aurora_monitor CHANGED
@@ -30,7 +30,7 @@ end
30
30
 
31
31
  options.parse!
32
32
 
33
- unless ARGV.length == 2
33
+ unless ARGV.length == 1
34
34
  puts options
35
35
  exit 1
36
36
  end
@@ -39,8 +39,8 @@ uri = URI.parse(ARGV[0])
39
39
 
40
40
  last_registers = {}
41
41
 
42
- SENSOR_REGISTERS = [16, 19, 20, 740, 900, 1109, 1105, 1106, 1107, 1108, 1110, 1111, 1114, 1117, 1134, 1147, 1149, 1151,
43
- 1153, 1165].freeze
42
+ SENSOR_REGISTERS = [16, 19, 20, 740, 900, 901, 903, 908, 909, 1109, 1105, 1106, 1107, 1108, 1110, 1111, 1114, 1117,
43
+ 1134, 1148, 1149, 1150, 1151, 1152, 1153, 1164, 1165, 3326, 3330].freeze
44
44
 
45
45
  io = case uri.scheme
46
46
  when "tcp"
@@ -76,7 +76,11 @@ diff_and_print = lambda do |registers|
76
76
  end
77
77
 
78
78
  server.request_callback = lambda { |uid, func, req|
79
- if func == 68
79
+ if func == 6
80
+ puts "#{Time.now} ===== write register to #{uid}:"
81
+ registers = { req[:addr] => req[:val] }
82
+ puts Aurora.print_registers(registers)
83
+ elsif func == 68
80
84
  puts "#{Time.now} ===== no idea to #{uid}: #{req.inspect}" unless diff_only
81
85
  elsif func == 67
82
86
  puts "#{Time.now} ===== write discontiguous registers to #{uid}:"
@@ -125,7 +129,7 @@ server.response_callback = lambda { |uid, func, res, req|
125
129
  puts "#{Time.now} ===== read discontiguous registers from #{uid}" unless diff_only
126
130
  registers = req.zip(res).to_h
127
131
  diff_and_print.call(registers)
128
- elsif [16, 67, 68].include?(func)
132
+ elsif [6, 16, 67, 68].include?(func)
129
133
  # no output
130
134
  else
131
135
  puts "#{Time.now} **** new func #{func}"
@@ -74,8 +74,19 @@ class MQTTBridge
74
74
  begin
75
75
  @mutex.synchronize do
76
76
  @abc.refresh
77
- @homie_abc.each do |property|
78
- property.value = @abc.public_send(property.id.tr("-", "_"))
77
+
78
+ components = { @homie_abc => @abc,
79
+ @blower => @abc.blower,
80
+ @pump => @abc.pump }
81
+ @abc.zones.each_with_index do |z, idx|
82
+ homie_zone = @homie["zone#{idx + 1}"]
83
+ components[homie_zone] = z
84
+ end
85
+
86
+ components.each do |(node, object)|
87
+ node.each do |property|
88
+ property.value = object.public_send(property.id.tr("-", "_"))
89
+ end
79
90
  end
80
91
 
81
92
  if @abc.dhw?
@@ -87,13 +98,6 @@ class MQTTBridge
87
98
  @abc.faults.each_with_index do |fault_count, i|
88
99
  @faults["e#{i + 1}"].value = fault_count
89
100
  end
90
-
91
- @abc.zones.each_with_index do |z, idx|
92
- homie_zone = @homie["zone#{idx + 1}"]
93
- homie_zone.each do |property|
94
- property.value = z.public_send(property.id.tr("-", "_"))
95
- end
96
- end
97
101
  end
98
102
  rescue => e
99
103
  warn "got garbage: #{e}; #{e.backtrace}"
@@ -113,7 +117,6 @@ class MQTTBridge
113
117
  unit: "ºF")
114
118
  node.property("entering-water-temperature", "Entering Water Temperature", :float,
115
119
  @abc.entering_water_temperature, unit: "ºF")
116
- node.property("fan-speed", "Fan Speed", :integer, @abc.fan_speed, format: 0..11)
117
120
  node.property("leaving-air-temperature", "Leaving Air Temperature", :float, @abc.leaving_air_temperature,
118
121
  unit: "ºF")
119
122
  node.property("leaving-water-temperature", "Leaving Water Temperature", :float, @abc.leaving_water_temperature,
@@ -123,22 +126,60 @@ class MQTTBridge
123
126
  end
124
127
  node.property("relative-humidity", "Relative Humidity", :integer, @abc.relative_humidity, unit: "%",
125
128
  format: 0..100)
126
- node.property("waterflow", "Waterflow", :float, @abc.waterflow, unit: "gpm")
127
129
  node.property("fp1", "FP1 Sensor", :float, @abc.fp1, unit: "ºF")
128
130
  node.property("fp2", "FP2 Sensor", :float, @abc.fp2, unit: "ºF")
129
- %i[compressor blower aux_heat loop_pump total].each do |component|
131
+ %i[compressor aux_heat total].each do |component|
130
132
  component = "#{component}_watts"
131
133
  node.property(component.tr("_", "-"), component.tr("_", " ").titleize, :integer,
132
134
  @abc.public_send(component), unit: "W")
133
135
  end
136
+ end
137
+
138
+ @blower = @homie.node("blower", "Blower", @abc.blower.type) do |node|
139
+ if @abc.blower.respond_to?(:running)
140
+ node.property("running", "Blower is running", :boolean, @abc.blower.running?)
141
+ else
142
+ node.property("speed", "Current blower speed", :integer, @abc.blower.speed, format: @abc.blower.speed_range)
143
+ end
144
+ node.property("watts", "Energy Usage", :integer, @abc.blower.watts, unit: "W") if @abc.energy_monitoring?
145
+
146
+ next unless @abc.blower.is_a?(Aurora::Blower::ECM)
147
+
148
+ presets = %w[blower-only aux-heat]
149
+ presets.concat %w[low-compressor high-compressor] unless @abc.iz2?
150
+ presets.each do |setting|
151
+ field = "#{setting.tr('-', '_')}_speed"
152
+ node.property("#{setting}-speed", "#{setting.tr('-', ' ').titleize} Preset Speed", :integer,
153
+ @abc.blower.public_send(field), format: 1..12) do |value, property|
154
+ @mutex.synchronize { property.value = @abc.blower.public_send("#{field}=", value) }
155
+ end
156
+ end
157
+ if @abc.iz2?
158
+ node.property("iz2-desired-speed", "IZ2 Desired Speed", :integer, @abc.blower.iz2_desired_speed,
159
+ format: 0..100, unit: "%")
160
+ end
161
+ end
162
+
163
+ @pump = @homie.node("pump", "Loop Pump", @abc.pump.type) do |node|
164
+ node.property("waterflow", "Waterflow", :float, @abc.pump.waterflow, unit: "gpm")
165
+ node.property("watts", "Energy Usage", :integer, @abc.pump.watts, unit: "W") if @abc.energy_monitoring?
134
166
 
135
- node.property("blower-only-ecm-speed", "Blower Only ECM Speed", :integer, @abc.blower_only_ecm_speed,
136
- format: 1..12) do |value, property|
137
- @mutex.synchronize { property.value = @abc.blower_only_ecm_speed = value }
167
+ next unless @abc.pump.is_a?(Aurora::Pump::VSPump)
168
+
169
+ node.property("speed", "Speed", :integer, @abc.pump.speed, format: 0..100, unit: "%") do |value, property|
170
+ @mutex.synchronize { property.value = @abc.pump.speed = value }
171
+ end
172
+ node.property("manual-control", "If manual control is enabled", :boolean,
173
+ @abc.pump.manual_control?) do |value, property|
174
+ @mutex.synchronize { property.value = @abc.pump.manual_control = value }
175
+ end
176
+ node.property("minimum-speed", "Speed pump runs at compressor speed 0", :integer, @abc.pump.minimum_speed,
177
+ format: 0..100, unit: "%") do |value, property|
178
+ @mutex.synchronize { property.value = @abc.pump.minimum_speed = value }
138
179
  end
139
- node.property("aux-heat-ecm-speed", "Aux Heat ECM Speed", :integer, @abc.aux_heat_ecm_speed,
140
- format: 1..12) do |value, property|
141
- @mutex.synchronize { property.value = @abc.aux_heat_ecm_speed = value }
180
+ node.property("maximum-speed", "Speed pump runs at compressor speed 12", :integer, @abc.pump.minimum_speed,
181
+ format: 0..100, unit: "%") do |value, property|
182
+ @mutex.synchronize { property.value = @abc.pump.maximum_speed = value }
142
183
  end
143
184
  end
144
185
 
@@ -3,6 +3,11 @@
3
3
  require "yaml"
4
4
  require "uri"
5
5
 
6
+ require "aurora/blower"
7
+ require "aurora/iz2_zone"
8
+ require "aurora/pump"
9
+ require "aurora/thermostat"
10
+
6
11
  module Aurora
7
12
  class ABCClient
8
13
  class << self
@@ -35,9 +40,10 @@ module Aurora
35
40
  attr_reader :modbus_slave,
36
41
  :serial_number,
37
42
  :zones,
43
+ :blower,
44
+ :pump,
38
45
  :faults,
39
46
  :current_mode,
40
- :fan_speed,
41
47
  :dhw_enabled,
42
48
  :dhw_setpoint,
43
49
  :entering_air_temperature,
@@ -46,27 +52,37 @@ module Aurora
46
52
  :leaving_water_temperature,
47
53
  :entering_water_temperature,
48
54
  :dhw_water_temperature,
49
- :waterflow,
50
55
  :compressor_speed,
51
56
  :outdoor_temperature,
52
57
  :fp1,
53
58
  :fp2,
54
- :blower_only_ecm_speed,
55
- :aux_heat_ecm_speed,
56
59
  :compressor_watts,
57
- :blower_watts,
58
60
  :aux_heat_watts,
59
- :loop_pump_watts,
60
61
  :total_watts
61
62
 
62
63
  def initialize(uri)
63
64
  @modbus_slave = self.class.open_modbus_slave(uri)
64
65
  @modbus_slave.read_retry_timeout = 15
65
66
  @modbus_slave.read_retries = 2
66
- registers = Aurora.transform_registers(@modbus_slave.holding_registers[88..91, 105...110, 1114])
67
+ raw_registers = @modbus_slave.holding_registers[88..91, 105...110, 404, 412..413, 1114]
68
+ registers = Aurora.transform_registers(raw_registers.dup)
67
69
  @program = registers[88]
68
70
  @serial_number = registers[105]
69
71
  @dhw_water_temperature = registers[1114]
72
+ @energy_monitor = raw_registers[412]
73
+
74
+ @blower = case raw_registers[404]
75
+ when 1, 2 then Blower::ECM.new(self, registers[404])
76
+ when 3 then Blower::FiveSpeed.new(self, registers[404])
77
+ else; Blower::PSC.new(self, registers[404])
78
+ end
79
+ @pump = if (3..5).include?(raw_registers[413])
80
+ Pump::VSPump.new(self,
81
+ registers[413])
82
+ else
83
+ Pump::GenericPump.new(self,
84
+ registers[413])
85
+ end
70
86
 
71
87
  @zones = if iz2?
72
88
  iz2_zone_count = @modbus_slave.holding_registers[483]
@@ -112,9 +128,11 @@ module Aurora
112
128
  end
113
129
 
114
130
  def refresh
115
- registers_to_read = [6, 19..20, 25, 30, 340, 344, 347, 740..741, 900, 1110..1111, 1114, 1117, 1147..1153, 1165,
131
+ registers_to_read = [6, 19..20, 25, 30, 344, 740..741, 900, 1110..1111, 1114, 1147..1153, 1165,
116
132
  31_003]
117
133
  registers_to_read << (400..401) if dhw?
134
+ registers_to_read.concat(blower.registers_to_read)
135
+ registers_to_read.concat(pump.registers_to_read)
118
136
  registers_to_read.concat([362, 3001]) if vs_drive?
119
137
 
120
138
  if zones.first.is_a?(IZ2Zone)
@@ -138,7 +156,6 @@ module Aurora
138
156
 
139
157
  outputs = registers[30]
140
158
 
141
- @fan_speed = registers[344]
142
159
  @dhw_enabled = registers[400]
143
160
  @dhw_setpoint = registers[401]
144
161
  @entering_air_temperature = registers[740]
@@ -147,7 +164,6 @@ module Aurora
147
164
  @leaving_water_temperature = registers[1110]
148
165
  @entering_water_temperature = registers[1111]
149
166
  @dhw_water_temperature = registers[1114]
150
- @waterflow = registers[1117]
151
167
  @compressor_speed = if vs_drive?
152
168
  registers[3001]
153
169
  elsif outputs.include?(:cc2)
@@ -164,12 +180,8 @@ module Aurora
164
180
  @error = registers[25] & 0x7fff
165
181
  @derated = (41..46).include?(@error)
166
182
  @safe_mode = [47, 48, 49, 72, 74].include?(@error)
167
- @blower_only_ecm_speed = registers[340]
168
- @aux_heat_ecm_speed = registers[347]
169
183
  @compressor_watts = registers[1147]
170
- @blower_watts = registers[1149]
171
184
  @aux_heat_watts = registers[1151]
172
- @loop_pump_watts = registers[1165]
173
185
  @total_watts = registers[1153]
174
186
 
175
187
  @current_mode = if outputs.include?(:lockout)
@@ -190,23 +202,14 @@ module Aurora
190
202
  :standby
191
203
  end
192
204
 
205
+ blower.refresh(registers)
206
+ pump.refresh(registers)
207
+
193
208
  zones.each do |z|
194
209
  z.refresh(registers)
195
210
  end
196
211
  end
197
212
 
198
- def blower_only_ecm_speed=(value)
199
- return unless (1..12).include?(value)
200
-
201
- @modbus_slave.holding_registers[340] = value
202
- end
203
-
204
- def aux_heat_ecm_speed=(value)
205
- return unless (1..12).include?(value)
206
-
207
- @modbus_slave.holding_registers[347] = value
208
- end
209
-
210
213
  def cooling_airflow_adjustment=(value)
211
214
  value = 0x10000 + value if value.negative?
212
215
  @modbus_slave.holding_registers[346] = value
@@ -226,20 +229,6 @@ module Aurora
226
229
  @modbus_slave.holding_registers[419] = (value * 10).to_i
227
230
  end
228
231
 
229
- def vs_pump_control=(value)
230
- raise ArgumentError unless (value = VS_PUMP_CONTROL.invert[value])
231
-
232
- @modbus_slave.holding_registers[323] = value
233
- end
234
-
235
- def vs_pump_min=(value)
236
- @modbus_slave.holding_registers[321] = value
237
- end
238
-
239
- def vs_pump_max=(value)
240
- @modbus_slave.holding_registers[322] = value
241
- end
242
-
243
232
  def line_voltage=(value)
244
233
  raise ArgumentError unless (90..635).include?(value)
245
234
 
@@ -277,6 +266,10 @@ module Aurora
277
266
  @modbus_slave.holding_registers[323] = pump_speed == :with_compressor ? 0x7fff : pump_speed
278
267
  end
279
268
 
269
+ def energy_monitoring?
270
+ @energy_monitor == 2
271
+ end
272
+
280
273
  def vs_drive?
281
274
  @program == "ABCVSP"
282
275
  end
@@ -289,7 +282,8 @@ module Aurora
289
282
  { thermostat: 800, axb: 806, iz2: 812, aoc: 815, moc: 818, eev2: 824 }.each do |(component, register)|
290
283
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
291
284
  def #{component}?
292
- @modbus_slave.holding_registers[#{register}] != 3
285
+ return @#{component} if instance_variable_defined?(:@#{component})
286
+ @#{component} = @modbus_slave.holding_registers[#{register}] != 3
293
287
  end
294
288
 
295
289
  def add_#{component}
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "aurora/component"
4
+
5
+ module Aurora
6
+ module Blower
7
+ class GenericBlower < Component
8
+ attr_reader :type, :watts
9
+
10
+ def initialize(abc, type)
11
+ super(abc)
12
+ @type = type
13
+ end
14
+
15
+ def registers_to_read
16
+ if abc.energy_monitoring?
17
+ [1148..1149]
18
+ else
19
+ []
20
+ end
21
+ end
22
+
23
+ def refresh(registers)
24
+ @watts = registers[1148] if abc.energy_monitoring?
25
+ end
26
+ end
27
+
28
+ class PSC < GenericBlower
29
+ attr_reader :running
30
+ alias running? running
31
+
32
+ def refresh(registers)
33
+ @running = registers[30].include?(:g)
34
+ end
35
+ end
36
+
37
+ class FiveSpeed < GenericBlower
38
+ attr_reader :speed
39
+
40
+ def speed_range
41
+ 0..4
42
+ end
43
+
44
+ def refresh(registers)
45
+ outputs = registers[30]
46
+ @speed = if outputs.include?(:eh1)
47
+ 4
48
+ elsif outputs.include?(:cc2)
49
+ 3
50
+ elsif outputs.include?(:cc)
51
+ 2
52
+ elsif outputs.include?(:g)
53
+ 1
54
+ else
55
+ 0
56
+ end
57
+ end
58
+ end
59
+
60
+ class ECM < GenericBlower
61
+ attr_reader :speed, :blower_only_speed, :low_compressor_speed, :high_compressor_speed, :aux_heat_speed,
62
+ :iz2_desired_speed
63
+
64
+ def speed_range
65
+ 0..12
66
+ end
67
+
68
+ def registers_to_read
69
+ result = super + [340..342, 344, 347]
70
+ result << 565 if abc.iz2?
71
+ result
72
+ end
73
+
74
+ def refresh(registers)
75
+ super
76
+
77
+ @speed = registers[344]
78
+ @blower_only_speed = registers[340]
79
+ @low_compressor_speed = registers[341]
80
+ @high_compressor_speed = registers[342]
81
+ @aux_heat_speed = registers[347]
82
+ @iz2_desired_speed = registers[565] if abc.iz2?
83
+ end
84
+
85
+ { blower_only: 340,
86
+ low_compressor: 341,
87
+ high_compressor: 342,
88
+ aux_heat: 347 }.each do |(setting, register)|
89
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
90
+ def #{setting}_speed=(value)
91
+ raise ArgumentError unless (1..12).include?(value)
92
+
93
+ holding_registers[#{register}] = value
94
+ end
95
+ RUBY
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Aurora
4
+ class Component
5
+ def initialize(abc)
6
+ @abc = abc
7
+ end
8
+
9
+ private
10
+
11
+ attr_reader :abc
12
+
13
+ def holding_registers
14
+ abc.modbus_slave.holding_registers
15
+ end
16
+ end
17
+ end
@@ -41,28 +41,28 @@ module Aurora
41
41
  def target_mode=(value)
42
42
  return unless (raw_value = Aurora::HEATING_MODE.invert[value])
43
43
 
44
- @abc.modbus_slave.holding_registers[21_202 + (zone_number - 1) * 9] = raw_value
44
+ holding_registers[21_202 + (zone_number - 1) * 9] = raw_value
45
45
  @target_mode = value
46
46
  end
47
47
 
48
48
  def target_fan_mode=(value)
49
49
  return unless (raw_value = Aurora::FAN_MODE.invert[value])
50
50
 
51
- @abc.modbus_slave.holding_registers[21_205 + (zone_number - 1) * 9] = raw_value
51
+ holding_registers[21_205 + (zone_number - 1) * 9] = raw_value
52
52
  @target_fan_mode = value
53
53
  end
54
54
 
55
55
  def fan_intermittent_on=(value)
56
56
  return unless value >= 0 && value <= 25 && (value % 5).zero?
57
57
 
58
- @abc.modbus_slave.holding_registers[21_206 + (zone_number - 1) * 9] = value
58
+ holding_registers[21_206 + (zone_number - 1) * 9] = value
59
59
  @fan_intermittent_on = value
60
60
  end
61
61
 
62
62
  def fan_intermittent_off=(value)
63
63
  return unless value >= 0 && value <= 40 && (value % 5).zero?
64
64
 
65
- @abc.modbus_slave.holding_registers[21_207 + (zone_number - 1) * 9] = value
65
+ holding_registers[21_207 + (zone_number - 1) * 9] = value
66
66
  @fan_intermittent_off = value
67
67
  end
68
68
 
@@ -70,7 +70,7 @@ module Aurora
70
70
  return unless value >= 40 && value <= 90
71
71
 
72
72
  raw_value = (value * 10).to_i
73
- @abc.modbus_slave.holding_registers[21_203 + (zone_number - 1) * 9] = raw_value
73
+ holding_registers[21_203 + (zone_number - 1) * 9] = raw_value
74
74
  @heating_target_temperature = value
75
75
  end
76
76
 
@@ -78,8 +78,8 @@ module Aurora
78
78
  return unless value >= 54 && value <= 99
79
79
 
80
80
  raw_value = (value * 10).to_i
81
- @abc.modbus_slave.holding_registers[21_204 + (zone_number - 1) * 9] = value
82
- @cooling_target_temperature = raw_value
81
+ holding_registers[21_204 + (zone_number - 1) * 9] = raw_value
82
+ @cooling_target_temperature = value
83
83
  end
84
84
  end
85
85
  end
@@ -44,5 +44,6 @@ module Aurora
44
44
  def write_holding_register(addr, value)
45
45
  @registers[addr] = value
46
46
  end
47
+ alias []= write_holding_register
47
48
  end
48
49
  end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "aurora/component"
4
+
5
+ module Aurora
6
+ module Pump
7
+ class GenericPump < Component
8
+ attr_reader :type, :watts, :waterflow
9
+
10
+ def initialize(abc, type)
11
+ super(abc)
12
+ @type = type
13
+ end
14
+
15
+ def registers_to_read
16
+ result = [1117]
17
+ result.concat([1164..1165]) if abc.energy_monitoring?
18
+ result
19
+ end
20
+
21
+ def refresh(registers)
22
+ @waterflow = registers[1117]
23
+ @watts = registers[1164] if abc.energy_monitoring?
24
+ end
25
+ end
26
+
27
+ class VSPump < GenericPump
28
+ attr_reader :speed, :minimum_speed, :maximum_speed, :manual_control
29
+ alias manual_control? manual_control
30
+
31
+ def registers_to_read
32
+ super + [321..325]
33
+ end
34
+
35
+ def refresh(registers)
36
+ super
37
+ @minimum_speed = registers[321]
38
+ @maximum_speed = registers[322]
39
+ @manual_control = registers[323] != :off
40
+ @speed = registers[325]
41
+ end
42
+
43
+ def manual_control=(value)
44
+ holding_registers[323] = value ? speed : 0x7fff
45
+ end
46
+
47
+ { speed: 323,
48
+ minimum_speed: 321,
49
+ maximum_speed: 322 }.each do |(setting, register)|
50
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
51
+ def #{setting}=(value)
52
+ raise ArgumentError unless (1..100).include?(value)
53
+
54
+ holding_registers[#{register}] = value
55
+ end
56
+ RUBY
57
+ end
58
+ end
59
+ end
60
+ end
@@ -234,13 +234,6 @@ module Aurora
234
234
  0x800 => :alarm
235
235
  }.freeze
236
236
 
237
- # 5-speed ECM shows
238
- # Aux if eh1 is on
239
- # High if cc2 is on
240
- # Med if cc1 is on
241
- # Low if blower is on
242
- # Off
243
-
244
237
  SYSTEM_INPUTS = {
245
238
  0x01 => :y1,
246
239
  0x02 => :y2,
@@ -483,7 +476,7 @@ module Aurora
483
476
  REGISTER_CONVERTERS = {
484
477
  TO_HUNDREDTHS => [2, 3, 417, 418, 801, 804, 807, 813, 816, 817, 819, 820, 825, 828],
485
478
  method(:dipswitch_settings) => [4, 33],
486
- TO_TENTHS => [19, 20, 401, 419, 501, 502, 567, 740, 745, 746, 747, 900,
479
+ TO_TENTHS => [19, 20, 401, 419, 501, 502, 567, 740, 745, 746, 747, 900, 901, 903,
487
480
  1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1119, 1124, 1125, 1134,
488
481
  3322, 3323, 3325, 3326, 3327, 3330, 3522, 3903, 3905, 3906,
489
482
  12_619, 12_620,
@@ -547,7 +540,7 @@ module Aurora
547
540
  REGISTER_FORMATS = {
548
541
  "%ds" => [1, 6, 9, 15, 84, 85, 110],
549
542
  "%dV" => [16, 112, 3331, 3424, 3523],
550
- "%0.1fºF" => [19, 20, 401, 501, 502, 567, 740, 745, 746, 747, 900,
543
+ "%0.1fºF" => [19, 20, 401, 501, 502, 567, 740, 745, 746, 747, 900, 903,
551
544
  1109, 1110, 1111, 1112, 1113, 1114, 1124, 1125, 1134, 1135, 1136,
552
545
  3325, 3326, 3327, 3330, 3522, 3903, 3905, 3906,
553
546
  12_619, 12_620,
@@ -560,8 +553,8 @@ module Aurora
560
553
  31_003,
561
554
  31_007, 31_010, 31_013, 31_016, 31_019, 31_022],
562
555
  "E%d" => [25, 26],
563
- "%d%%" => [282, 321, 322, 325, 346, 565, 741, 1126, 3332, 3524, 3808],
564
- "%0.1f psi" => [419, 1115, 1116, 1119, 3322, 3323],
556
+ "%d%%" => [282, 321, 322, 325, 346, 565, 741, 908, 1126, 3332, 3524, 3808],
557
+ "%0.1f psi" => [419, 901, 1115, 1116, 1119, 3322, 3323],
565
558
  "%0.1fA" => [1105, 1106, 1107, 1108],
566
559
  "%0.1fgpm" => [1117],
567
560
  "%dW" => [1146, 1148, 1150, 1152, 1164, 3422],
@@ -819,6 +812,10 @@ module Aurora
819
812
  828 => "AWL Version",
820
813
  829 => "AWL Revision",
821
814
  900 => "Leaving Air",
815
+ 901 => "Suction Pressure",
816
+ 903 => "SuperHeat Temperature",
817
+ 908 => "EEV Open %",
818
+ 909 => "SubCooling (Cooling)",
822
819
  1103 => "AXB Inputs",
823
820
  1104 => "AXB Outputs",
824
821
  1105 => "Blower Amps",
@@ -848,10 +845,6 @@ module Aurora
848
845
  1154 => "Heat of Extraction",
849
846
  1156 => "Heat of Rejection",
850
847
  1164 => "Pump Watts",
851
- 12_606 => "Heating Mode (write)",
852
- 12_619 => "Heating Setpoint (write)",
853
- 12_620 => "Cooling Setpoint (write)",
854
- 12_621 => "Fan Mode (write)",
855
848
  3000 => "Compressor Speed Desired",
856
849
  3001 => "Compressor Speed Actual",
857
850
  3002 => "Manual Operation",
@@ -883,6 +876,10 @@ module Aurora
883
876
  3904 => "VS Drive Leaving Air Temperature?",
884
877
  3905 => "VS Drive Saturated Evaporator Discharge Temperature",
885
878
  3906 => "VS Drive SuperHeat Temperature",
879
+ 12_606 => "Heating Mode (write)",
880
+ 12_619 => "Heating Setpoint (write)",
881
+ 12_620 => "Cooling Setpoint (write)",
882
+ 12_621 => "Fan Mode (write)",
886
883
  31_003 => "Outdoor Temp",
887
884
  31_005 => "IZ2 Demand",
888
885
  31_109 => "Humidifier Mode", # write to 21114
@@ -1,21 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "aurora/component"
4
+
3
5
  module Aurora
4
- class Thermostat
6
+ class Thermostat < Component
5
7
  attr_reader :target_mode,
6
8
  :target_fan_mode,
7
9
  :ambient_temperature,
8
10
  :cooling_target_temperature,
9
11
  :heating_target_temperature
10
12
 
11
- def initialize(abc)
12
- @abc = abc
13
- end
14
-
15
13
  def refresh(registers)
16
14
  @ambient_temperature = registers[502]
17
- @heating_target_temperature = registers[746]
18
- @cooling_target_temperature = registers[745]
15
+ @heating_target_temperature = registers[745]
16
+ @cooling_target_temperature = registers[746]
19
17
  end
20
18
 
21
19
  def target_mode=(value)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Aurora
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.5"
5
5
  end
data/lib/aurora.rb CHANGED
@@ -3,9 +3,7 @@
3
3
  require "rmodbus"
4
4
 
5
5
  require "aurora/abc_client"
6
- require "aurora/iz2_zone"
7
6
  require "aurora/mock_abc"
8
- require "aurora/thermostat"
9
7
  require "aurora/modbus/server"
10
8
  require "aurora/modbus/slave"
11
9
  require "aurora/registers"
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.4.1
4
+ version: 0.4.5
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-31 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ccutrer-serialport
@@ -134,11 +134,14 @@ files:
134
134
  - exe/web_aid_tool
135
135
  - lib/aurora.rb
136
136
  - lib/aurora/abc_client.rb
137
+ - lib/aurora/blower.rb
138
+ - lib/aurora/component.rb
137
139
  - lib/aurora/core_ext/string.rb
138
140
  - lib/aurora/iz2_zone.rb
139
141
  - lib/aurora/mock_abc.rb
140
142
  - lib/aurora/modbus/server.rb
141
143
  - lib/aurora/modbus/slave.rb
144
+ - lib/aurora/pump.rb
142
145
  - lib/aurora/registers.rb
143
146
  - lib/aurora/thermostat.rb
144
147
  - lib/aurora/version.rb