def cast_response_to_correct_types(d)

      # Integers
      [:meter_firmware,
       :kwh_data_decimal_places,
       :watts_l1,
       :watts_l2,
       :watts_l3,
       :watts_total,
       :ct_ratio,
       :pulse_1_count,
       :pulse_1_ratio,
       :pulse_2_count,
       :pulse_2_ratio,
       :pulse_3_count,
       :pulse_3_ratio,
       :reactive_power_1,
       :reactive_power_2,
       :reactive_power_3,
       :total_reactive_power,
       :settable_pulse_per_kwh_ratio,
       :pulse_input_hilo,
       :direction_of_current,
       :outputs_onoff,
       :maximum_demand_period,
       :auto_reset_max_demand
      ].each do |k|
        d[k] = d[k].to_i if d.has_key?(k)
      end

      # Floats with precision 1
      [:volts_l1,
       :volts_l2,
       :volts_l3,
       :amps_l1,
       :amps_l2,
       :amps_l3,
       :maximum_demand
      ].each do |k|
        d[k] = to_f_with_decimal_places(d[k], 1) if d.has_key?(k)
      end

      # Floats with precision 2
      [:frequency
      ].each do |k|
        d[k] = to_f_with_decimal_places(d[k], 2) if d.has_key?(k)
      end

      # Floats with precision set by kwh_data_decimal_places
      [:total_kwh,
       :reactive_kwh_kvarh,
       :total_forward_kwh,
       :total_reverse_kwh,
       :net_kwh,
       :total_kwh_l1,
       :total_kwh_l2,
       :total_kwh_l3,
       :reverse_kwh_l1,
       :reverse_kwh_l2,
       :reverse_kwh_l3,
       :resettable_total_kwh,
       :resettable_reverse_kwh,
       :total_kwh_t1,
       :total_kwh_t2,
       :total_kwh_t3,
       :total_kwh_t4,
       :reverse_kwh_t1,
       :reverse_kwh_t2,
       :reverse_kwh_t3,
       :reverse_kwh_t4
      ].each do |k|
        d[k] = to_kwh_float(d[k]) if d.has_key?(k)
      end

    end
def cast_response_to_correct_types(d)

      # Integers
      [:meter_firmware,
       :kwh_data_decimal_places,
       :watts_l1,
       :watts_l2,
       :watts_l3,
       :watts_total,
       :ct_ratio,
       :pulse_1_count,
       :pulse_1_ratio,
       :pulse_2_count,
       :pulse_2_ratio,
       :pulse_3_count,
       :pulse_3_ratio,
       :reactive_power_1,
       :reactive_power_2,
       :reactive_power_3,
       :total_reactive_power,
       :settable_pulse_per_kwh_ratio,
       :pulse_input_hilo,
       :direction_of_current,
       :outputs_onoff,
       :maximum_demand_period,
       :auto_reset_max_demand
      ].each do |k|
        d[k] = d[k].to_i if d.has_key?(k)
      end

      # Floats with precision 1
      [:volts_l1,
       :volts_l2,
       :volts_l3,
       :amps_l1,
       :amps_l2,
       :amps_l3,
       :maximum_demand
      ].each do |k|
        d[k] = to_f_with_decimal_places(d[k], 1) if d.has_key?(k)
      end

      # Floats with precision 2
      [:frequency
      ].each do |k|
        d[k] = to_f_with_decimal_places(d[k], 2) if d.has_key?(k)
      end

      # Floats with precision set by kwh_data_decimal_places
      [:total_kwh,
       :reactive_kwh_kvarh,
       :total_forward_kwh,
       :total_reverse_kwh,
       :net_kwh,
       :total_kwh_l1,
       :total_kwh_l2,
       :total_kwh_l3,
       :reverse_kwh_l1,
       :reverse_kwh_l2,
       :reverse_kwh_l3,
       :resettable_total_kwh,
       :resettable_reverse_kwh,
       :total_kwh_t1,
       :total_kwh_t2,
       :total_kwh_t3,
       :total_kwh_t4,
       :reverse_kwh_t1,
       :reverse_kwh_t2,
       :reverse_kwh_t3,
       :reverse_kwh_t4
      ].each do |k|
        d[k] = to_kwh_float(d[k]) if d.has_key?(k)
      end

    end
All values are returned without decimals. This method loops over all the values and sets them to the correct precision
 TODO: Seems like this could be done more elegantly with a DSL