def query_set_info(serial_num)
      packet = Jfy::Packet.new(Jfy::Codes::QUERY_SET_INFO, [], :dst => serial_num)
      packet = write(packet)

      fail(BadPacket, 'invalid set info response') unless packet.command == Jfy::Codes::QUERY_SET_INFO_RESP

      data = packet.data

      metrics = {
        :pv_voltage   => {
          :startup   => short(data, 0) / 10.0,
          :high_stop => short(data, 4) / 10.0,
          :low_stop  => short(data, 6) / 10.0,
        },
        :grid         => {
          :voltage   => {
            :min => short(data, 8) / 10.0,
            :max => short(data, 10) / 10.0,
          },
          :frequency => {
            :min => short(data, 12) / 100.0,
            :max => short(data, 14) / 100.0,
          },
          :impedance => {
            :max   => short(data, 16) / 1_000.0,
            :delta => short(data, 18),
          },
        },
        :power_max    => short(data, 20),
        :power_factor => short(data, 22) / 100.0,
        :connect_time => short(data, 2),
      }

      metrics
    end
def query_set_info(serial_num)
      packet = Jfy::Packet.new(Jfy::Codes::QUERY_SET_INFO, [], :dst => serial_num)
      packet = write(packet)

      fail(BadPacket, 'invalid set info response') unless packet.command == Jfy::Codes::QUERY_SET_INFO_RESP

      data = packet.data

      metrics = {
        :pv_voltage   => {
          :startup   => short(data, 0) / 10.0,
          :high_stop => short(data, 4) / 10.0,
          :low_stop  => short(data, 6) / 10.0,
        },
        :grid         => {
          :voltage   => {
            :min => short(data, 8) / 10.0,
            :max => short(data, 10) / 10.0,
          },
          :frequency => {
            :min => short(data, 12) / 100.0,
            :max => short(data, 14) / 100.0,
          },
          :impedance => {
            :max   => short(data, 16) / 1_000.0,
            :delta => short(data, 18),
          },
        },
        :power_max    => short(data, 20),
        :power_factor => short(data, 22) / 100.0,
        :connect_time => short(data, 2),
      }

      metrics
    end
rubocop:enable Metrics/AbcSize, Metrics/MethodLength
 rubocop:disable Metrics/AbcSize, Metrics/MethodLength