axpert_rs232 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/axpert_commands.rb +40 -40
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: feaf14c95a0bb048162f2de460083f56e1564c9a
4
- data.tar.gz: 124bfdfe33531983e742cff13ce5883ca8163d9f
3
+ metadata.gz: a54fab8227bba54bc259b6f3a70c0cb68dc743c5
4
+ data.tar.gz: c0d3ee2125751022a2081a63acb0b66429064872
5
5
  SHA512:
6
- metadata.gz: 4f69247e57e69cd8bee76208639a0fbd55f94743d85b9282fe7f1a300bbc289e85a6c2ae4859d3e55ab5d2417922a88712bd85465d88ff99b85af690bb53e0a7
7
- data.tar.gz: cd36a586e15a3f5421abf9260b63bcd5c7d35c0499876bf6b3adcf57212d635792d766d2f8bd1cefc281ff07f6e93465eaac4d6595f19822135302f09e3ed5b7
6
+ metadata.gz: af93589884350570a72090645722128917e62c78a6ac1dfaad45a3f17a4820548b9acd281b2359ebb0077a6ce002a1721e5f45fdb82dac59794d76fa7abca971
7
+ data.tar.gz: 8f7c3d21859b22d17539555d8105121cabdeb71fe21df02e003c171c4f36df76711d05d6a4209b31da470ed0a852011dc85b5bf3d443054e0f07277adc3f8e6b
@@ -17,7 +17,7 @@ module AxpertCommands
17
17
  # Returns:
18
18
  # # An Integer specifying the protocol ID
19
19
  # 30 # Example
20
- PROTOCOL_ID = OP.new(command: 'QPI', parser: lambda { |r| Integer(r.data[3..-1]) })
20
+ PROTOCOL_ID = OP.new(command: 'QPI', parser: lambda { |r| Integer(r.data[3..-1], 10) })
21
21
 
22
22
  ##
23
23
  # Device serial number
@@ -61,20 +61,20 @@ module AxpertCommands
61
61
  output_voltage: Float(r[2]),
62
62
  output_frequency: Float(r[3]),
63
63
  output_current: Float(r[4]),
64
- output_va: Integer(r[5]),
65
- output_watts: Integer(r[6]),
64
+ output_va: Integer(r[5], 10),
65
+ output_watts: Integer(r[6], 10),
66
66
  battery_voltage: Float(r[7]),
67
67
  battery_recharge_voltage: Float(r[8]),
68
68
  battery_under_voltage: Float(r[9]),
69
69
  battery_bulk_charge_voltage: Float(r[10]),
70
70
  battery_float_charge_voltage: Float(r[11]),
71
71
  battery_type: ::AxpertConstants::BATTERY_TYPE[r[12]],
72
- maximum_ac_charge_current: Integer(r[13]),
73
- maximum_charge_current: Integer(r[14]),
72
+ maximum_ac_charge_current: Integer(r[13], 10),
73
+ maximum_charge_current: Integer(r[14], 10),
74
74
  input_voltage_sensitivity: CONS::INPUT_VOLTAGE_SENSITIVITY[r[15]],
75
75
  output_source_priority: CONS::OUTPUT_SOURCE_PRIORITY[r[16]],
76
76
  charger_source_priority: CONS::CHARGER_SOURCE_PRIORITY[r[17]],
77
- maximum_parallel_units: Integer(r[18]),
77
+ maximum_parallel_units: Integer(r[18], 10),
78
78
  device_type: CONS::DEVICE_TYPE[r[19]],
79
79
  device_topology: CONS::DEVICE_TOPOLOGY[r[20]],
80
80
  output_mode: CONS::OUTPUT_MODE[r[21]],
@@ -119,18 +119,18 @@ module AxpertCommands
119
119
  grid_frequency: Float(r[1]),
120
120
  output_voltage: Float(r[2]),
121
121
  output_frequency: Float(r[3]),
122
- output_va: Integer(r[4]),
123
- output_watts: Integer(r[5]),
124
- output_load_percent: Integer(r[6]),
125
- dc_bus_voltage: Integer(r[7]),
122
+ output_va: Integer(r[4], 10),
123
+ output_watts: Integer(r[5], 10),
124
+ output_load_percent: Integer(r[6], 10),
125
+ dc_bus_voltage: Integer(r[7], 10),
126
126
  battery_voltage: Float(r[8]),
127
127
  battery_charge_current: Float(r[9]),
128
- battery_capacity_remaining: Integer(r[10]),
129
- inverter_heatsink_celsius_temperature: Integer(r[11]),
130
- pv_battery_input_current: Integer(r[12]),
128
+ battery_capacity_remaining: Integer(r[10], 10),
129
+ inverter_heatsink_celsius_temperature: Integer(r[11], 10),
130
+ pv_battery_input_current: Integer(r[12], 10),
131
131
  pv_input_voltage: Float(r[13]),
132
132
  solar_charge_controller_battery_voltage: Float(r[14]),
133
- battery_discharge_current: Integer(r[15]),
133
+ battery_discharge_current: Integer(r[15], 10),
134
134
  add_sbu_priority_version: status[0],
135
135
  configuration_changed: status[1],
136
136
  solar_charge_controller_firmware_changed: status[2],
@@ -206,12 +206,12 @@ module AxpertCommands
206
206
  r = r.data[1..-1].split(' ')
207
207
  { output_voltage: Float(r[0]),
208
208
  output_frequency: Float(r[1]),
209
- maximum_ac_charge_current: Integer(r[2]),
209
+ maximum_ac_charge_current: Integer(r[2], 10),
210
210
  battery_under_voltage: Float(r[3]),
211
211
  battery_float_charge_voltage: Float(r[4]),
212
212
  battery_bulk_charge_voltage: Float(r[5]),
213
213
  battery_recharge_voltage: Float(r[6]),
214
- maximum_charge_current: Integer(r[7]),
214
+ maximum_charge_current: Integer(r[7], 10),
215
215
  input_voltage_sensitivity: CONS::INPUT_VOLTAGE_SENSITIVITY[r[8]],
216
216
  output_source_priority: CONS::OUTPUT_SOURCE_PRIORITY[r[9]],
217
217
  charger_source_priority: CONS::CHARGER_SOURCE_PRIORITY[r[10]],
@@ -237,7 +237,7 @@ module AxpertCommands
237
237
  # Returns:
238
238
  # [10, 20, 30] # => Array of Integers, example given
239
239
  ACCEPTED_CHARGE_CURRENT_VALUES = OP.new(command: 'QMCHGCR', parser: lambda do |r|
240
- r.data[1..-1].split(' ').map { |s| Integer(s) }
240
+ r.data[1..-1].split(' ').map { |s| Integer(s, 10) }
241
241
  end)
242
242
 
243
243
  ##
@@ -246,7 +246,7 @@ module AxpertCommands
246
246
  # Returns:
247
247
  # [10, 20, 30] # => Array of Integers, example given
248
248
  ACCEPTED_UTILITY_CHARGE_CURRENT_VALUES = OP.new(command: 'QMUCHGCR', parser: lambda do |r|
249
- r.data[1..-1].split(' ').map { |s| Integer(s) }
249
+ r.data[1..-1].split(' ').map { |s| Integer(s, 10) }
250
250
  end)
251
251
 
252
252
  ##
@@ -275,7 +275,7 @@ module AxpertCommands
275
275
  # Returns:
276
276
  # # A Hash containing parallel device status information
277
277
  # { grid_voltage: 230.5, grid_current: 11.2, .. }
278
- PARALLEL_DEVICE_STATUS = OP.new(command: lambda { |i = 0| "QPGS#{Integer(i)}" }, parser: lambda do |r|
278
+ PARALLEL_DEVICE_STATUS = OP.new(command: lambda { |i = 0| "QPGS#{Integer(i, 10)}" }, parser: lambda do |r|
279
279
  r = r.data[1..-1].split(' ')
280
280
  status = r[19].chars
281
281
  { parallel_number_exists: Boolean(r[0]),
@@ -286,30 +286,30 @@ module AxpertCommands
286
286
  grid_frequency: Float(r[5]),
287
287
  output_voltage: Float(r[6]),
288
288
  output_frequency: Float(r[7]),
289
- output_va: Integer(r[8]),
290
- output_watts: Integer(r[9]),
291
- load_percentage: Integer(r[10]),
289
+ output_va: Integer(r[8], 10),
290
+ output_watts: Integer(r[9], 10),
291
+ load_percentage: Integer(r[10], 10),
292
292
  battery_voltage: Float(r[11]),
293
- battery_charge_current: Integer(r[12]),
294
- battery_capacity: Integer(r[13]),
293
+ battery_charge_current: Integer(r[12], 10),
294
+ battery_capacity: Integer(r[13], 10),
295
295
  pv_input_voltage: Float(r[14]),
296
- total_charge_current: Integer(r[15]),
297
- total_output_va: Integer(r[16]),
298
- total_output_watt: Integer(r[17]),
299
- total_load_percentage: Integer(r[18]),
296
+ total_charge_current: Integer(r[15], 10),
297
+ total_output_va: Integer(r[16], 10),
298
+ total_output_watt: Integer(r[17], 10),
299
+ total_load_percentage: Integer(r[18], 10),
300
300
  solar_charge_controller_enabled: Boolean(status[0]),
301
301
  charging_from_utility: Boolean(status[1]),
302
302
  charging_from_solar_charge_controller: Boolean(status[2]),
303
- battery_status: [:normal, :under, :open][Integer("#{status[3]}#{status[4]}")],
303
+ battery_status: [:normal, :under, :open][Integer("#{status[3]}#{status[4]}", 10)],
304
304
  line_status_ok: !Boolean(status[5]),
305
305
  load_on: Boolean(status[6]),
306
306
  configuration_changed: Boolean(status[7]),
307
307
  output_mode: CONS::OUTPUT_MODE[r[20]],
308
308
  charger_source_priority: CONS::CHARGER_SOURCE_PRIORITY[r[21]],
309
- maximum_charge_current: Integer(r[22]),
310
- device_maximum_charge_current: Integer(r[23]),
311
- pv_input_current: Integer(r[24]),
312
- battery_discharge_current: Integer(r[25]) }
309
+ maximum_charge_current: Integer(r[22], 10),
310
+ device_maximum_charge_current: Integer(r[23], 10),
311
+ pv_input_current: Integer(r[24], 10),
312
+ battery_discharge_current: Integer(r[25], 10) }
313
313
  end)
314
314
 
315
315
  ##
@@ -329,7 +329,7 @@ module AxpertCommands
329
329
  # Returns:
330
330
  # # A Boolean indicating if the frequency was set succesfully
331
331
  # true # Example
332
- SET_OUTPUT_FREQUENCY = OP.new(command: lambda { |input| "F#{Integer(input).to_s.rjust(2, '0')}" }, error_on_nak: false, parser: lambda { |r| (r.data == '(ACK') })
332
+ SET_OUTPUT_FREQUENCY = OP.new(command: lambda { |input| "F#{Integer(input, 10).to_s.rjust(2, '0')}" }, error_on_nak: false, parser: lambda { |r| (r.data == '(ACK') })
333
333
 
334
334
  ##
335
335
  # Set device output source priority
@@ -380,7 +380,7 @@ module AxpertCommands
380
380
  # true # Example
381
381
  SET_CHARGER_SOURCE_PRIORITY = OP.new(command: lambda do |mode, parallel_machine_number = nil|
382
382
  if parallel_machine_number.nil?
383
- "PPCP#{Integer(parallel_machine_number).to_s}#{CONS::CHARGER_SOURCE_PRIORITY.key(mode).to_s.rjust(2, '0')}"
383
+ "PPCP#{Integer(parallel_machine_number, 10).to_s}#{CONS::CHARGER_SOURCE_PRIORITY.key(mode).to_s.rjust(2, '0')}"
384
384
  else
385
385
  "PCP#{CONS::CHARGER_SOURCE_PRIORITY.key(mode).to_s.rjust(2, '0')}"
386
386
  end
@@ -481,11 +481,11 @@ module AxpertCommands
481
481
  # # A Boolean indicating if the maximum charging current was set successfully
482
482
  # true # Example
483
483
  SET_MAXIMUM_CHARGING_CURRENT = OP.new(command: lambda do |current, parallel_machine_number = 0|
484
- current = Integer(current)
484
+ current = Integer(current, 10)
485
485
  if (current >= 100)
486
- "MNCHGC#{Integer(parallel_machine_number).to_s}#{current.to_s.rjust(3, '0')}"
486
+ "MNCHGC#{Integer(parallel_machine_number, 10).to_s}#{current.to_s.rjust(3, '0')}"
487
487
  else
488
- "MCHGC#{Integer(parallel_machine_number).to_s}#{current.to_s.rjust(2, '0')}"
488
+ "MCHGC#{Integer(parallel_machine_number, 10).to_s}#{current.to_s.rjust(2, '0')}"
489
489
  end
490
490
  end, error_on_nak: false, parser: lambda { |r| (r.data == '(ACK') })
491
491
 
@@ -503,7 +503,7 @@ module AxpertCommands
503
503
  # # A Boolean indicating if the maximum charging current for utility was set successfully
504
504
  # true # Example
505
505
  SET_MAXIMUM_UTILITY_CHARGING_CURRENT = OP.new(command: lambda do |current, parallel_machine_number = 0|
506
- "MUCHGC#{Integer(parallel_machine_number).to_s}#{Integer(current).to_s.rjust(2, '0')}"
506
+ "MUCHGC#{Integer(parallel_machine_number, 10).to_s}#{Integer(current, 10).to_s.rjust(2, '0')}"
507
507
  end, error_on_nak: false, parser: lambda { |r| (r.data == '(ACK') })
508
508
 
509
509
  ##
@@ -520,7 +520,7 @@ module AxpertCommands
520
520
  # # A Boolean indicating if the parallel output mode was set successfully
521
521
  # true # Example
522
522
  SET_OUTPUT_MODE = OP.new(command: lambda do |mode, parallel_machine_number = 0|
523
- "POPM#{CONS::OUTPUT_MODE.key(mode)}#{Integer(parallel_machine_number).to_s}"
523
+ "POPM#{CONS::OUTPUT_MODE.key(mode)}#{Integer(parallel_machine_number, 10).to_s}"
524
524
  end, error_on_nak: false, parser: lambda { |r| (r.data == '(ACK') })
525
525
 
526
526
  require 'axpert_constants'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: axpert_rs232
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan van der Vyver
@@ -33,7 +33,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - '>='
35
35
  - !ruby/object:Gem::Version
36
- version: '0'
36
+ version: 1.9.3
37
37
  required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '>='