Class: LXP::Packet::ReadInput3
- Defined in:
- lib/lxp/packet/read_input3.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ ReadInput3
constructor
A new instance of ReadInput3.
-
#to_h ⇒ Object
Decode the data and return a hash of values in this input packet.
Methods inherited from ReadInput
Methods inherited from Base
#bytes, #data_length, #data_length=, #datalog_serial, #datalog_serial=, #device_function, #device_function=, #inverter_serial, #inverter_serial=, #packet_length, #packet_length=, parse, #protocol, #protocol=, #register, #register=, #tcp_function, #tcp_function=, #to_bin, #update_checksum, #value=, #value_length, #values
Constructor Details
#initialize ⇒ ReadInput3
Returns a new instance of ReadInput3.
8 9 10 11 12 13 |
# File 'lib/lxp/packet/read_input3.rb', line 8 def initialize super self.register = 80 self.value = 40 end |
Instance Method Details
#to_h ⇒ Object
Decode the data and return a hash of values in this input packet
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/lxp/packet/read_input3.rb', line 16 def to_h { # 0 = static 1 # 1 = R_INPUT # 2..12 = serial # 13/14 = length # 15..16? .. (observed: 10) max_chg_curr: Utils.int(@data[17, 2]) / 100.0, # A max_dischg_curr: Utils.int(@data[19, 2]) / 100.0, # A charge_volt_ref: Utils.int(@data[21, 2]) / 10.0, # V dischg_cut_volt: Utils.int(@data[23, 2]) / 10.0, # V # are these actually 2 bytes as well? # never seen data in them so its hard to tell. bat_status_0: @data[25], bat_status_1: @data[27], bat_status_2: @data[29], bat_status_3: @data[31], bat_status_4: @data[33], bat_status_5: @data[35], bat_status_6: @data[37], bat_status_7: @data[39], bat_status_8: @data[41], bat_status_9: @data[43], bat_status_inv: @data[45], bat_count: Utils.int(@data[47, 2]) } end |